fix卖回未完成禁止用指数提前结算,并纠正买卖VWAP回退。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user