Files
AI-Trader/agent
Bill 05620facc2 fix: update context_injector with trading_day_id after creation
Changes:
- Update context_injector.trading_day_id after trading_day record is created

Root Cause:
- ContextInjector was created before trading_day record existed
- trading_day_id was None when context_injector was initialized
- Even though trading_day_id was written to runtime config, the
  context_injector's attribute was never updated
- MCP tools use the injected trading_day_id parameter, not runtime config

Flow:
1. ModelDayExecutor creates ContextInjector (trading_day_id=None)
2. Agent.run_trading_session() creates trading_day record
3. NEW: Update context_injector.trading_day_id = trading_day_id
4. MCP tools receive trading_day_id via context injection

Impact:
- Fixes: "Trade failed: trading_day_id not found in runtime config"
- Trading tools (buy/sell) can now record actions properly
- Actions are linked to correct trading_day record

Related: agent/base_agent/base_agent.py:541-543
2025-11-04 23:04:47 -05:00
..