fix卖回未完成禁止用指数提前结算,并纠正买卖VWAP回退。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-13 10:50:50 +08:00
parent 53a624633d
commit 1aa279f191
4 changed files with 60 additions and 21 deletions
+12
View File
@@ -599,6 +599,18 @@ def sync_options_from_local_trades(
if pnl_src == "pending_sell":
status_label = "待卖回"
pnl_u = None
# 清掉曾用指数提前冻上的假真盈亏
try:
conn.execute(
"""
UPDATE options_trades
SET realized_pnl_usdt = NULL, pnl_settled = 0
WHERE id = ? AND COALESCE(pnl_settled, 0) = 1
""",
(trade_id,),
)
except Exception:
pass
elif pnl_u is not None and pnl_src not in ("none", "pending_sell"):
if frozen_usdt is None or abs(float(frozen_usdt) - float(pnl_u)) > 0.05:
try: