trading/tests
Viktor Barzin 82dc622544 feat(kevin): reconcile Alpaca bracket auto-closes + order status
Bracket stop-loss/take-profit legs fill at Alpaca without passing through the executor, so those closes (and their P&L) were invisible locally.

- broker: add get_order(nested) + list_orders to BaseBroker/AlpacaBroker (+ SimulatedBroker); BrokerOrder carries child legs

- Trade gains broker_order_id (migration f6a7b8c9d0e1); executor stamps the entry order id

- new api_gateway trade-reconcile loop: books a closing SELL + realized P&L when a bracket leg fills (idempotent on the leg order id), syncs PENDING->terminal status, logs drift; runs alongside portfolio_sync

[ci skip]

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 22:31:24 +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(kevin): reconcile Alpaca bracket auto-closes + order status 2026-06-04 22:31:24 +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(kevin): reconcile Alpaca bracket auto-closes + order status 2026-06-04 22:31:24 +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 feat(kevin): reconcile Alpaca bracket auto-closes + order status 2026-06-04 22:31:24 +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