Fix OKX abandon residual double-book and fill/residual ledger holes.
After dual-close leaves option pending, continue close_group instead of false residual; reject partial fills on wait timeout; LIVE residual settle allow_negative. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -854,11 +854,15 @@ class Matcher:
|
||||
opt_qty = float(row["option_qty_eth"])
|
||||
opt_pnl = (of.fill_px - opt_entry) * opt_qty
|
||||
opt_cash = of.notional - of.fee
|
||||
from ..config import get_settings
|
||||
|
||||
self.ledger.apply_cash(
|
||||
opt_cash,
|
||||
kind="close_option",
|
||||
group_id=group_id,
|
||||
note=f"residual option expiry settle{' force' if force else ''}",
|
||||
# LIVE 本地账本仅镜像;拒记会导致 residual 永久 pending
|
||||
allow_negative=not get_settings().is_sim,
|
||||
)
|
||||
|
||||
with self.db._lock:
|
||||
|
||||
Reference in New Issue
Block a user