chore: finalize broker qty metadata consistency

Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-08-24 14:19:26 +00:00
committed by GitHub
co-authored by genichin
parent 30bcbe1d12
commit f394f1560d
3 changed files with 17 additions and 13 deletions
+7 -6
View File
@@ -273,18 +273,19 @@ def make_slots_rpc_handler(
except AccountSnapshotUnavailable:
broker_qty_available = False
for row, slot in zip(slot_rows, slots):
for row, slot in zip(slot_rows, slots, strict=True):
row["slot_quantity"] = row.get("qty")
row["qty_source"] = None
row["broker_quantity_available"] = False
row["broker_quantity_captured_at"] = None
if slot.status.value != "holding":
continue
row["broker_quantity_available"] = broker_qty_available
row["broker_quantity_captured_at"] = (
broker_qty_captured_at.isoformat() if broker_qty_captured_at is not None else None
)
if broker_qty_available:
broker_qty = int(broker_qty_by_symbol.get(str(slot.symbol), 0))
row["qty"] = float(broker_qty)
row["qty_source"] = "broker"
row["broker_quantity_available"] = True
row["broker_quantity_captured_at"] = broker_qty_captured_at.isoformat()
else:
row["qty"] = None
row["qty_source"] = "unavailable"
@@ -296,7 +297,7 @@ def make_slots_rpc_handler(
slot_ids = [s.slot_id for s in slots]
occ = {s.slot_id: getattr(s, "occupancy_seq", 0) for s in slots}
state_map = strategy_state_store.get_for_slots(slot_ids, occ)
for row, s in zip(slot_rows, slots):
for row, s in zip(slot_rows, slots, strict=True):
entries = state_map.get(s.slot_id)
if entries:
row["strategy_state"] = {