TradingAgents/tradingagents/agents
Michael Msebenzi 176b24be86
feat: add pre-trade market state verification to risk management
Add a Market Gate node between the risk debate and Portfolio Manager
that verifies the target exchange is open before trade execution.

- New `market_gate.py` with `check_market_state()` and `create_market_gate()`
- Calls Headless Oracle /v5/demo (free, no API key required)
- Fail-closed: network errors default to UNKNOWN (blocked)
- Ticker suffix → MIC mapping for 22 global exchanges
- Injects [MARKET GATE] advisory into risk debate history
- Optional via `use_market_gate` config flag (default: True)
- 12 new tests covering MIC resolution, HTTP mocking, and node behavior
- Zero new dependencies (stdlib urllib only)

Resolves #514

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 13:58:43 +00:00
..
analysts refactor: remove stale imports, use configurable results path (#499) 2026-04-04 07:35:35 +00:00
managers refactor: remove stale imports, use configurable results path (#499) 2026-04-04 07:35:35 +00:00
researchers refactor: remove stale imports, use configurable results path (#499) 2026-04-04 07:35:35 +00:00
risk_mgmt feat: add pre-trade market state verification to risk management 2026-04-07 13:58:43 +00:00
trader refactor: remove stale imports, use configurable results path (#499) 2026-04-04 07:35:35 +00:00
utils refactor: remove stale imports, use configurable results path (#499) 2026-04-04 07:35:35 +00:00
__init__.py feat: add pre-trade market state verification to risk management 2026-04-07 13:58:43 +00:00