trading/tests/services
Viktor Barzin f7ca671bf3
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was canceled
feat(phase2): BRACKET orders + Kevin risk caps (Tasks 18, 19)
Task 18 — OrderRequest + AlpacaBroker BRACKET support:
- OrderRequest gains order_class ("simple" | "bracket"),
  take_profit_price, stop_loss_price + model_validator that requires
  both legs when order_class == "bracket".
- AlpacaBroker._build_order_request branches to a MarketOrderRequest
  with OrderClass.BRACKET + TakeProfitRequest + StopLossRequest legs,
  TimeInForce.GTC so the bracket survives day boundaries.

Task 19 — RiskManager Kevin caps + circuit-breaker:
- TradeExecutorConfig gains 4 fields: kevin_daily_trade_cap,
  kevin_daily_alloc_cap_usd, kevin_equity_drawdown_halt_pct,
  kevin_daily_loss_circuit_pct.
- check_risk() applies the caps only when
  signal.strategy_id == KEVIN_STRATEGY_UUID; non-Kevin signals pass
  through the existing path unchanged.
- 4 new checks in order: drawdown halt (sets permanent
  trading:paused), daily-loss circuit (setex 24h), daily trade-count
  cap, daily allocation cap (rolling today's $ + this trade's
  notional).
- Counter keys: kevin:daily_trades:YYYY-MM-DD,
  kevin:daily_alloc_usd:YYYY-MM-DD, kevin:daily_pnl_usd:YYYY-MM-DD,
  kevin:starting_equity_usd. All read-only here; bridge + executor
  write them.

Tests: 5 bracket + 9 kevin-caps + 28 regression-safe. Total 67 + 14
new = 81 passing (excluding -m integration). No DB needed.
2026-05-26 21:03:59 +00:00
..
kevin_signal_bridge test(kevin): fix enum assertion + mark Postgres-dependent tests as integration 2026-05-26 20:01:37 +00:00
meet_kevin_watcher refactor(meet-kevin): switch LLM back to native Anthropic SDK with OAuth bearer 2026-05-22 19:24:40 +00:00
trade_executor feat(phase2): BRACKET orders + Kevin risk caps (Tasks 18, 19) 2026-05-26 21:03:59 +00:00
__init__.py feat: sentiment analyzer — FinBERT + Ollama tiered analysis 2026-02-22 15:27:06 +00:00
test_api_auth.py feat: API gateway with passkey (WebAuthn) authentication 2026-02-22 15:53:48 +00:00
test_api_routes.py feat: productionize local service — fix signal pipeline, lower thresholds, add company-name ticker extraction 2026-02-22 22:17:26 +00:00
test_learning_engine.py feat: learning engine — multi-armed bandit strategy weight adjustment 2026-02-22 15:43:11 +00:00
test_market_data.py feat: productionize local service — fix signal pipeline, lower thresholds, add company-name ticker extraction 2026-02-22 22:17:26 +00:00
test_news_fetcher.py feat: news fetcher service — RSS and Reddit sources 2026-02-22 15:25:27 +00:00
test_portfolio_sync.py fix: resolve all remaining TODOs, add dev mode auth bypass 2026-02-25 22:02:25 +00:00
test_sentiment_analyzer.py feat: real data pipeline — market data, DB persistence, portfolio sync, signal-trade linkage 2026-02-22 19:52:45 +00:00
test_signal_generator.py feat: real data pipeline — market data, DB persistence, portfolio sync, signal-trade linkage 2026-02-22 19:52:45 +00:00
test_trade_executor.py fix: resolve all remaining TODOs, add dev mode auth bypass 2026-02-25 22:02:25 +00:00