TradingAgents/tradingagents
Claude 2c53fe184b
feat: medium-term positioning upgrade (debate rounds, TTM, peer comparison, macro regime)
## Changes

### Step 1: Agentic Debate Depth
- Increase `max_debate_rounds` and `max_risk_discuss_rounds` from 1 → 2 in `default_config.py`
- Fix bug in `trading_graph.py`: wire config values into `ConditionalLogic()` (was ignoring config, using hardcoded defaults)

### Step 2: 8-Quarter TTM Fundamental Analysis
- New `tradingagents/dataflows/ttm_analysis.py`: parses quarterly income/balance/cashflow CSV strings, computes TTM (sum of last 4 quarters), QoQ/YoY growth rates, margin trends across 8 quarters
- New `@tool get_ttm_analysis` in `fundamental_data_tools.py`
- Wire into fundamentals ToolNode; register in `TOOLS_CATEGORIES`
- Update fundamentals analyst prompt: "last 8 quarters (2 years)" focus

### Step 3: Sector & Peer Relative Performance
- New `tradingagents/dataflows/peer_comparison.py`: sector peer lookup, 1W/1M/3M/6M/YTD return ranking, alpha vs sector ETF
- New `@tool get_peer_comparison` and `@tool get_sector_relative`
- Wire into fundamentals ToolNode

### Step 4: Macro Regime Flag
- New `tradingagents/dataflows/macro_regime.py`: 6-signal classifier (VIX level/trend, credit spread HYG/LQD, yield curve TLT/SHY, market breadth SPX vs 200-SMA, sector rotation) → risk-on / transition / risk-off
- New `@tool get_macro_regime`; add `macro_regime_report` field to AgentState
- Wire into market ToolNode; feed into research_manager and risk_manager prompts

### Step 5: Tests (88 new unit tests, 0 integration)
- `tests/test_debate_rounds.py` (17 tests)
- `tests/test_ttm_analysis.py` (18 tests)
- `tests/test_peer_comparison.py` (11 tests)
- `tests/test_macro_regime.py` (16 tests)
- `tests/test_config_wiring.py` (12 tests)

All 88 new unit tests pass; no regressions in existing tests.

https://claude.ai/code/session_01TuPpssTo83whKkNgSu57HH
2026-03-17 19:55:43 +00:00
..
agents feat: medium-term positioning upgrade (debate rounds, TTM, peer comparison, macro regime) 2026-03-17 19:55:43 +00:00
dataflows feat: medium-term positioning upgrade (debate rounds, TTM, peer comparison, macro regime) 2026-03-17 19:55:43 +00:00
graph feat: medium-term positioning upgrade (debate rounds, TTM, peer comparison, macro regime) 2026-03-17 19:55:43 +00:00
llm_clients feat: Complete 3-phase LLM scanner pipeline with inline tool execution 2026-03-17 08:41:40 +01:00
pipeline feat: Complete 3-phase LLM scanner pipeline with inline tool execution 2026-03-17 08:41:40 +01:00
default_config.py feat: medium-term positioning upgrade (debate rounds, TTM, peer comparison, macro regime) 2026-03-17 19:55:43 +00:00