fix: align report paths and improve node name mapping for live streaming

- update portfolio summary route to check 'summary/' directory for scan results
- enhance LangGraph event mapping to extract functional node names from metadata
- fix initial state keys for ScannerGraph to match TradingAgents internals
This commit is contained in:
Ahmet Guzererler 2026-03-22 22:46:21 +01:00
parent d5df6b93a4
commit c9e5e8989f
1 changed files with 8 additions and 9 deletions

View File

@ -17,22 +17,21 @@ class LangGraphEngine:
"""Run the 3-phase macro scanner and stream events.""" """Run the 3-phase macro scanner and stream events."""
date = params.get("date", time.strftime("%Y-%m-%d")) date = params.get("date", time.strftime("%Y-%m-%d"))
# Initialize ScannerGraph # Initialize ScannerGraph correctly
# Note: ScannerGraph in TradingAgents seems to take date and config scanner = ScannerGraph(config=self.config)
scanner = ScannerGraph(date=date, config=self.config)
print(f"Engine: Starting SCAN {run_id} for date {date}") print(f"Engine: Starting SCAN {run_id} for date {date}")
# Initial state for scanner # Initial state for scanner - must match ScannerGraph.scan's initial_state keys
# Based on tradingagents/graph/scanner_graph.py
initial_state = { initial_state = {
"date": date, "scan_date": date,
"messages": [],
"geopolitical_report": "", "geopolitical_report": "",
"market_movers_report": "", "market_movers_report": "",
"sector_report": "", "sector_performance_report": "",
"industry_deep_dive_report": "", "industry_deep_dive_report": "",
"macro_synthesis_report": "", "macro_scan_summary": "",
"top_10_watchlist": [] "sender": "",
} }
async for event in scanner.graph.astream_events(initial_state, version="v2"): async for event in scanner.graph.astream_events(initial_state, version="v2"):