fix复盘真盈亏按权利金USDT波动公式计算,忽略现货多买。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-13 10:16:44 +08:00
parent c2c69e580c
commit 3416996ae5
10 changed files with 249 additions and 280 deletions
+2 -3
View File
@@ -510,9 +510,8 @@ def close_option_by_bid1(
fee_ccy=str(row["fee_ccy"] or row["premium_ccy"] or row_ccy or ""),
)
pnl = settled.get("realized_pnl")
# 有交易账户 before 快照:U 盈亏等卖回后结算,平仓不写 realized_pnl_usdt
has_acct_snap = _safe_float(row["trading_usdt_before"]) is not None
pnl_usdt = None if has_acct_snap else settled.get("realized_pnl_usdt")
# 复盘真盈亏=权利金 USDT 波动口径;账户 after 另在卖回后拍快照
pnl_usdt = settled.get("realized_pnl_usdt")
note_sql = ""
# 占位: close_quote/recv/pnl/ord/closed_at/open_fee/close_fee/fee_ccy/close_idx/open_idx/pnl_u/[note]/id