fix开仓价卖回价与真盈亏一次冻结,复盘同步不再反复改写。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-13 10:56:53 +08:00
parent 1aa279f191
commit aa8b16ce27
5 changed files with 106 additions and 64 deletions
+2 -1
View File
@@ -308,12 +308,13 @@ def settle_closed_trades_from_trading_account(
)
if pnl_u is None or src in ("none", "pending_sell"):
continue
# 卖回价一次冻结为卖回 VWAP;开仓价已在开仓时冻住,仅缺省时补
conn.execute(
"""
UPDATE options_trades
SET trading_usdt_after = COALESCE(?, trading_usdt_after),
realized_pnl_usdt = ?,
open_index_px = COALESCE(?, open_index_px),
open_index_px = COALESCE(open_index_px, ?),
close_index_px = COALESCE(?, close_index_px),
pnl_settled = 1
WHERE id = ? AND COALESCE(pnl_settled, 0)=0