docs(rfc): address gemini-code-assist review feedback

- Architecture: list all 5 memory instances in init diagram
  - Architecture: fix duplicate fill color in ANALYSTS mermaid style
  - RFC: reference existing quick_think_llm (gpt-5.4-mini) instead of gpt-4o-mini
  - RFC: make walk-forward test window configurable (default 20% of N, min 5)
  - RFC: write outputs to config['results_dir'], drop package-local results/ dir
This commit is contained in:
Smith-S-S 2026-04-06 14:34:14 +08:00
parent 21889a89c5
commit 7ae1a20697
2 changed files with 13 additions and 11 deletions

View File

@ -29,7 +29,7 @@ flowchart TD
GRAPH --> LLM_FACTORY["create_llm_client() - factory.py"]
LLM_FACTORY --> DEEP["deep_thinking_llm"]
LLM_FACTORY --> QUICK["quick_thinking_llm"]
GRAPH --> MEM_INIT["Initialize Memories<br/>bull_memory, bear_memory, trader_memory"]
GRAPH --> MEM_INIT["Initialize 5 Memories<br/>bull_memory, bear_memory, trader_memory,<br/>invest_judge_memory, portfolio_manager_memory"]
end
USER --> PROPAGATOR["Propagator<br/>Creates initial state"]
@ -79,7 +79,7 @@ flowchart TD
SP --> DECISION["Final Decision Returned to User"]
style ANALYSTS fill:#e1f5fe,e1f5fe,stroke:#0277bd,stroke-width:2px,color:#01579b
style ANALYSTS fill:#e1f5fe,stroke:#0277bd,stroke-width:2px,color:#01579b
style DEBATE fill:#fff3e0,stroke:#ef6c00,stroke-width:2px,color:#e65100
style TRADE fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px,color:#1b5e20
style RISK fill:#fce4ec,stroke:#c2185b,stroke-width:2px,color:#880e4f

View File

@ -37,7 +37,7 @@ This is essentially **walk-forward backtesting with self-improvement** — a pro
| Risk | Mitigation |
|---|---|
| **LLM API costs** | Each day = ~12 agent calls with LLM. 30 days = 360+ LLM calls. Use `gpt-4o-mini` for quick_think |
| **LLM API costs** | Each day = ~12 agent calls with LLM. 30 days = 360+ LLM calls. Reuse existing `quick_think_llm` (currently `gpt-5.4-mini` in `default_config.py`) for cheap agents; only use `deep_think_llm` where reasoning depth is required |
| **Overfitting to past data** | Don't tune prompts to specific dates — tune the APPROACH (which tools matter, what indicators to prioritize) |
| **Look-ahead bias** | When predicting day 11, the agents must ONLY see data up to day 10. Never leak future data |
| **Rate limits** | yfinance and Alpha Vantage have limits. Add delays between runs |
@ -110,7 +110,7 @@ flowchart TD
subgraph LOGIC["How Training Window Works"]
L1["Take training window of historical data"]
L2["Split: first N-10 days = context<br/>last 10 days = walk-forward test"]
L2["Split: first (N - test_window) days = context<br/>last test_window days = walk-forward test<br/>(test_window is configurable;<br/>default ~20% of N, min 5 days)"]
L3["Predict day by day through test window"]
L4["After test: use full window to predict FUTURE"]
end
@ -225,9 +225,11 @@ flowchart TD
PR --> HARNESS["model_harness.py<br/>Orchestrates the full pipeline:<br/>setup → train → eval → predict → viz"]
PR --> PROMPT_PY["prompt.py<br/>Configurable analysis prompts<br/>and research focus areas"]
PR --> VIZ_PY["visualization.py<br/>Side-by-side charts<br/>(actual vs predicted)"]
PR --> RESULTS["results/<br/>Excel/CSV output files"]
end
OUTPUTS_NOTE["All generated artifacts (Excel, CSV, charts)<br/>are written to config['results_dir']<br/>from default_config.py — NOT committed<br/>inside the source package"]
HARNESS -.->|"writes outputs to"| OUTPUTS_NOTE
subgraph EXISTING_USED["Existing Files We Use (Don't Modify)"]
EX1["tradingagents/graph/trading_graph.py<br/>TradingAgentsGraph class"]
EX2["tradingagents/graph/reflection.py<br/>reflect_and_remember()"]
@ -259,7 +261,7 @@ flowchart TD
FETCH["Fetch full historical data<br/>yfinance: get_stock_data(ticker, start, end)"]
SPLIT["Split data:<br/>context_days = window[:-10]<br/>test_days = window[-10:]"]
SPLIT["Split data (configurable test_window):<br/>context_days = window[:-test_window]<br/>test_days = window[-test_window:]<br/>Default: test_window = max(5, int(0.2 * N))"]
INIT["Initialize TradingAgentsGraph<br/>with fresh memories"]
@ -306,10 +308,10 @@ flowchart TD
M6["Best/Worst Days<br/>Biggest wins and losses"]
end
subgraph OUTPUT["Output Files"]
O1["results/training_log.xlsx<br/>Every prediction with details"]
O2["results/metrics_summary.xlsx<br/>All metrics in one sheet"]
O3["results/memory_dump.json<br/>What the agents learned"]
subgraph OUTPUT["Output Files (written to config['results_dir'])"]
O1["{results_dir}/training_log.xlsx<br/>Every prediction with details"]
O2["{results_dir}/metrics_summary.xlsx<br/>All metrics in one sheet"]
O3["{results_dir}/memory_dump.json<br/>What the agents learned"]
end
INPUT --> METRICS
@ -369,7 +371,7 @@ flowchart TD
H6["Phase 3: PREDICT<br/>model.predict_future()"]
H7["Phase 4: VISUALIZE<br/>visualization.create_dashboard()"]
H8["Save all results to results/"]
H8["Save all results to config['results_dir']"]
H1 --> H2 --> H3 --> H4 --> H5 --> H6 --> H7 --> H8
end