fix(events): add optional side field to OrderFilledEvent

OrderFilledEvent had no side field, forcing api/main.py's chart() to
backfill it from the sibling order_submitted row. Add an additive-only
`side: str | None = None` field (existing payloads without it still
parse) and populate it at the sole production emit site
(alpaca_paper/execution.py _finalize) from the ExecutionRequest already
in scope. The api/main.py backfill workaround is left in place as a
harmless fallback for pre-existing events.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
momentum devandClaude Fable 5 committed 2026-07-17 20:47:17 -05:00
1 parent 849bd476f9
commit 9772aca6bc
4 files changed
+61

No files matched your search

+2
View File
@@ -216,11 +216,13 @@ class AlpacaPaperExecutor:
order_id=request.order_id,
fill_price=fill_price or 0.0,
fill_quantity=filled_qty,
side=request.side,
payload={
"symbol": request.symbol,
"order_id": request.order_id,
"fill_price": fill_price,
"fill_quantity": filled_qty,
"side": request.side,
},
)
)