trading/services
Viktor Barzin 2855e79af4 feat(trade-executor): defer outside_market_hours signals to next open
Kevin's signals are mid-long term (weeks/months) and he uploads almost
exclusively pre-market or evenings. Before this change, every such
signal hit RiskManager.outside_market_hours, got consumed off the
Redis stream, and was lost. End result: 71 emitted signals, 0 trades.

New behaviour: when RiskManager rejects with outside_market_hours,
push the signal into a Redis sorted-set keyed by next_market_open
(via Alpaca's clock API — handles weekends + holidays). A background
drain task polls the set every kevin_defer_drain_interval_s (60s);
any signal whose target <= now gets re-run through process_signal.

Safety:
  - kevin_max_defer_hours (default 72h) caps signal staleness so we
    don't trade on week-old views.
  - Other RiskManager rejections (cooldown, kill-switch, drawdown
    halt) fall through to the existing drop path.
  - kevin_defer_outside_market_hours toggle defaults True; flip to
    false for legacy behaviour.

Slack: new notify_deferred() emits "🕒 Meet Kevin: DEFERRED
NVDA until Mon 13:30 UTC (market closed; conviction 0.85)" instead
of the noisy outside_market_hours rejection spam.

Tests: 5 queue + 4 integration = 9 new, all 32 trade-executor tests
GREEN.
2026-06-01 19:01:37 +00:00
..
api_gateway feat(backtest): wire real Alpaca historical fetcher 2026-05-26 21:09:40 +00:00
kevin_signal_bridge fix(kevin_bridge): persist signal to signals table before audit row 2026-05-26 21:23:59 +00:00
learning_engine fix: resolve all remaining TODOs, add dev mode auth bypass 2026-02-25 22:02:25 +00:00
market_data feat: productionize local service — fix signal pipeline, lower thresholds, add company-name ticker extraction 2026-02-22 22:17:26 +00:00
meet_kevin_watcher feat(meet-kevin): prompt v2 — forward-looking action + expected_move field 2026-05-28 21:40:07 +00:00
news_fetcher fix: resolve 13 important issues from code review 2026-02-22 17:58:01 +00:00
sentiment_analyzer fix: flush article before creating sentiment FK references 2026-02-23 20:57:11 +00:00
signal_generator feat: wire 6 new strategies and fundamentals into signal generator 2026-02-23 21:55:59 +00:00
trade_executor feat(trade-executor): defer outside_market_hours signals to next open 2026-06-01 19:01:37 +00:00
__init__.py feat: sentiment analyzer — FinBERT + Ollama tiered analysis 2026-02-22 15:27:06 +00:00