fix(execution): cancel SQL nullable type error, KIS child cancel detection, worker exception logging
Co-authored-by: genichin <4282227+genichin@users.noreply.github.com>
This commit is contained in:
co-authored by
genichin
parent
2b412fd786
commit
f0ac909958
@@ -440,6 +440,25 @@ class KISBroker:
|
||||
"inquiry_date": inquiry_date,
|
||||
},
|
||||
)
|
||||
# dcy-013 ext: KIS sometimes records an external cancel as a separate
|
||||
# child row with orgn_odno=<original> and cncl_yn="Y" rather than
|
||||
# setting cncl_yn on the original row. Scan sibling rows to detect
|
||||
# this case. Correction (정정) children will NOT have cncl_yn="Y" so
|
||||
# they are not misclassified as cancels here.
|
||||
child_cancel_row = next(
|
||||
(
|
||||
r
|
||||
for r in rows
|
||||
if (str(r.get("orgn_odno") or "").strip().lstrip("0") or "0") == normalized_odno
|
||||
and str(r.get("cncl_yn") or "").strip().upper() == "Y"
|
||||
),
|
||||
None,
|
||||
)
|
||||
if child_cancel_row is not None and str(row.get("cncl_yn") or "").strip().upper() != "Y":
|
||||
# Inject the cancel signal from the child row into the parent row so
|
||||
# _fill_status_from_row can treat it as cancelled, while keeping
|
||||
# the original row's fill quantities authoritative.
|
||||
row = {**row, "cncl_yn": "Y", "_child_cancel_odno": str(child_cancel_row.get("odno") or "")}
|
||||
status = self._fill_status_from_row(
|
||||
row, side=side, today=inquiry_date, fallback_odno=odno
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user