fix: preserve SOR execution venue separately
This commit is contained in:
@@ -137,6 +137,44 @@ def test_submit_sor_preserves_sor(monkeypatch):
|
||||
assert captured["body"]["EXCG_ID_DVSN_CD"] == "SOR"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("row", "expected"),
|
||||
[
|
||||
({"ord_exg_gb": "1"}, "KRX"),
|
||||
({"ord_exg_gb": "2"}, "NXT"),
|
||||
({"ord_exg_gb": "3"}, "KRX"),
|
||||
({"ord_exg_gb": "4"}, "NXT"),
|
||||
({"excg_id_dvsn_cd": "KRX"}, "KRX"),
|
||||
({"excg_id_dvsn_cd": "NXT"}, "NXT"),
|
||||
({"excg_id_dvsn_cd": "SOR-KRX"}, "KRX"),
|
||||
({"excg_id_dvsn_Cd": "SOR-NXT"}, "NXT"),
|
||||
({"excg_id_dvsn_cd": "SOR"}, None),
|
||||
({"excg_dvsn_cd": "02"}, None),
|
||||
({}, None),
|
||||
],
|
||||
)
|
||||
def test_kis_execution_venue_parser_is_allowlisted(row, expected):
|
||||
assert KISBroker._execution_venue_from_row(row) == expected
|
||||
|
||||
|
||||
def test_kis_fill_status_carries_sor_actual_execution_venue():
|
||||
status = KISBroker._fill_status_from_row(
|
||||
{
|
||||
"ord_qty": "10",
|
||||
"tot_ccld_qty": "10",
|
||||
"avg_prvs": "70000",
|
||||
"ord_dt": "20260819",
|
||||
"ord_gno_brno": "12345",
|
||||
"odno": "0000000001",
|
||||
"excg_id_dvsn_cd": "NXT",
|
||||
},
|
||||
side="buy",
|
||||
today="20260819",
|
||||
fallback_odno="0000000001",
|
||||
)
|
||||
assert status.execution_venue == "NXT"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# REQ-117 AC-4: 기존 위치 인수 순서 불변
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -20,7 +20,8 @@ def _trade(execution_id="paper:1:10") -> LedgerTrade:
|
||||
return LedgerTrade(
|
||||
asset_id="PF-1", order_id="ORD-1", execution_id=execution_id,
|
||||
side="buy", qty=10, price=1000.0, fee=1.5, tax=0.0,
|
||||
executed_at=datetime(2026, 6, 4, tzinfo=timezone.utc), venue="NXT",
|
||||
executed_at=datetime(2026, 6, 4, tzinfo=timezone.utc),
|
||||
venue="NXT", order_venue="SOR",
|
||||
)
|
||||
|
||||
|
||||
@@ -33,6 +34,7 @@ def test_enqueue_persists_and_is_idempotent(pg_clean):
|
||||
assert len(pending) == 1
|
||||
assert pending[0].status is WorkItemStatus.PENDING
|
||||
assert pending[0].trade.venue == "NXT"
|
||||
assert pending[0].trade.order_venue == "SOR"
|
||||
|
||||
|
||||
def test_writer_completes_persisted_item(pg_clean):
|
||||
|
||||
Reference in New Issue
Block a user