TradingAgents/tests
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
..
test_google_api_key.py refactor: simplify api_key mapping and consolidate tests 2026-03-24 14:52:51 +01:00
test_market_gate.py feat: add pre-trade market state verification to risk management 2026-04-07 13:58:43 +00:00
test_model_validation.py sync model validation with cli catalog 2026-03-25 21:23:02 +08:00
test_ticker_symbol_handling.py fix: preserve exchange-qualified tickers across agent prompts 2026-03-21 21:10:13 +08:00