feat: propagate intent venue through execution

This commit is contained in:
jordan
2026-07-29 16:55:20 +09:00
parent 7084304c9f
commit 479cb39a7e
22 changed files with 314 additions and 19 deletions
+4
View File
@@ -56,6 +56,9 @@ class Slot:
# holding episode. Used by the strategy-state CAS to reject writes computed
# against a prior occupancy of a reused slot (point-ABA guard, dcy-028 R-1).
occupancy_seq: int = 0
# Order venue carried from the admitted intent through dispatch/cancel.
# It is reset to KRX when the permanent asset slot returns to INACTIVE.
venue: str = "KRX"
# Canonical column contract for `Slot` (dcy-001 OQ-2 / FR-5).
@@ -84,6 +87,7 @@ EXPECTED_SLOT_FIELDS: frozenset[str] = frozenset({
"timeout_sec", # dcy-022 / REQ-068 (BAT-032)
"slippage_pct", # dcy-022 / REQ-068 (BAT-032)
"occupancy_seq", # dcy-028 / REQ-081 (BAT-042)
"venue",
})
+5
View File
@@ -85,6 +85,7 @@ class SlotService:
# dcy-022 / REQ-068: execution policy (set on PENDING entry, cleared on exit).
timeout_sec: Optional[int] = None,
slippage_pct: Optional[float] = None,
venue: Optional[str] = None,
extra: Optional[dict[str, Any]] = None,
) -> Slot:
"""Transition slot from one state to another atomically.
@@ -133,6 +134,7 @@ class SlotService:
take_profit_price=take_profit_price,
timeout_sec=timeout_sec,
slippage_pct=slippage_pct,
venue=venue,
)
self._repo.update_slot(updated)
@@ -173,6 +175,7 @@ class SlotService:
take_profit_price: Optional[Decimal] = None,
timeout_sec: Optional[int] = None,
slippage_pct: Optional[float] = None,
venue: Optional[str] = None,
) -> Slot:
"""Compute the post-transition Slot row.
@@ -201,6 +204,7 @@ class SlotService:
take_profit_price=None,
timeout_sec=None,
slippage_pct=None,
venue="KRX",
updated_at=datetime.now(tz=timezone.utc),
)
@@ -267,6 +271,7 @@ class SlotService:
timeout_sec=new_timeout_sec,
slippage_pct=new_slippage_pct,
occupancy_seq=new_occupancy_seq,
venue=venue if venue is not None else slot.venue,
updated_at=datetime.now(tz=timezone.utc),
)