fix: preserve SOR execution venue separately
This commit is contained in:
@@ -773,6 +773,20 @@ class ExecutionService:
|
||||
if resolved_price is not None
|
||||
else (float(fs.avg_price) if fs.avg_price is not None else 0.0)
|
||||
)
|
||||
execution_venue = fs.execution_venue
|
||||
if execution_venue is None and slot.venue in {"KRX", "NXT"}:
|
||||
execution_venue = slot.venue
|
||||
if execution_venue not in {"KRX", "NXT"}:
|
||||
r.ledger_skipped += 1
|
||||
_log.warning(
|
||||
"ledger skip: slot=%s portfolio_id=%s side=%s "
|
||||
"reason=missing_execution_venue order_venue=%s",
|
||||
slot.slot_id,
|
||||
slot.portfolio_id,
|
||||
side,
|
||||
slot.venue,
|
||||
)
|
||||
return
|
||||
trade = LedgerTrade(
|
||||
asset_id=str(slot.portfolio_id),
|
||||
order_id=str(broker_order_id),
|
||||
@@ -783,7 +797,8 @@ class ExecutionService:
|
||||
fee=float(fs.fee),
|
||||
tax=float(fs.tax),
|
||||
executed_at=datetime.now(tz=timezone.utc),
|
||||
venue=slot.venue,
|
||||
venue=execution_venue,
|
||||
order_venue=slot.venue,
|
||||
)
|
||||
self._ledger_outbox.enqueue(trade)
|
||||
r.ledger_enqueued += 1
|
||||
|
||||
Reference in New Issue
Block a user