trading/tests
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(api): /api/meet-kevin/strategy/* routes 2026-05-24 01:12:16 +00:00
backtester feat(kevin-strategy): integrate expected_move into trading decision 2026-05-28 22:45:24 +00:00
fixtures feat(meet-kevin): caption extractor via yt-dlp 2026-05-21 19:40:52 +00:00
integration feat: integration tests, seed data, and smoke test script 2026-02-22 16:02:44 +00:00
services feat(trade-executor): defer outside_market_hours signals to next open 2026-06-01 19:01:37 +00:00
shared feat(kevin-strategy): integrate expected_move into trading decision 2026-05-28 22:45:24 +00:00
__init__.py feat: project foundation — monorepo setup, shared config, redis streams, telemetry 2026-02-22 15:13:26 +00:00
conftest.py feat(kevin): SA models for bridge audit + backtest persistence 2026-05-24 00:49:52 +00:00
test_backtester.py feat: backtesting engine — historical replay with shared strategies 2026-02-22 15:43:19 +00:00
test_broker.py feat: brokerage abstraction layer with Alpaca implementation 2026-02-22 15:26:41 +00:00
test_fundamentals.py refactor: reconcile FundamentalsSnapshot to use canonical schema from trading.py 2026-02-23 21:45:18 +00:00
test_indicators.py feat: add MACD, Bollinger, VWAP, ATR, EMA, SMA-200 indicator computations 2026-02-23 21:49:26 +00:00
test_models.py test(kevin): fix enum assertion + mark Postgres-dependent tests as integration 2026-05-26 20:01:37 +00:00
test_new_strategies.py feat: add 6 new strategies (value, MACD, Bollinger, VWAP, liquidity, MA stack) 2026-02-23 21:50:52 +00:00
test_redis_streams.py fix(redis-streams): survive blocking-read timeout on idle streams 2026-05-29 05:49:15 +00:00
test_schemas.py fix(schemas): use enum types as field types + enforce symbol length 2026-05-21 19:15:59 +00:00
test_strategies.py feat: productionize local service — fix signal pipeline, lower thresholds, add company-name ticker extraction 2026-02-22 22:17:26 +00:00