trading/shared
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
..
broker feat(kevin): reconcile Alpaca bracket auto-closes + order status 2026-06-04 22:31:24 +00:00
constants feat(kevin): SA models for bridge audit + backtest persistence 2026-05-24 00:49:52 +00:00
fundamentals feat: add fundamentals DB model and cached provider 2026-02-23 21:49:31 +00:00
models feat(kevin): reconcile Alpaca bracket auto-closes + order status 2026-06-04 22:31:24 +00:00
schemas feat(kevin): reconcile Alpaca bracket auto-closes + order status 2026-06-04 22:31:24 +00:00
strategies 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
config.py feat: project foundation — monorepo setup, shared config, redis streams, telemetry 2026-02-22 15:13:26 +00:00
db.py feat: database models and alembic migrations — all tables per design 2026-02-22 15:17:07 +00:00
redis_streams.py fix(redis-streams): survive blocking-read timeout on idle streams 2026-05-29 05:49:15 +00:00
telemetry.py feat: project foundation — monorepo setup, shared config, redis streams, telemetry 2026-02-22 15:13:26 +00:00