fix复盘真盈亏改为期权币盈亏×平仓价,不再绑卖回与初始权利金差。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -505,26 +505,20 @@ def close_option_by_bid1(
|
||||
row_open_idx = float(bv)
|
||||
except Exception:
|
||||
pass
|
||||
row_pc = str(row["premium_ccy"] or row_ccy or premium_ccy or "").strip().upper()
|
||||
settled = settle_closed_pnl(
|
||||
premium_paid=paid,
|
||||
premium_received=recv,
|
||||
open_fee=row_ofee,
|
||||
close_fee=row_cfee,
|
||||
premium_ccy=row_pc or premium_ccy,
|
||||
premium_ccy=str(row["premium_ccy"] or row_ccy or premium_ccy),
|
||||
index_px=close_idx,
|
||||
open_index_px=row_open_idx,
|
||||
budget_usdt=row_budget,
|
||||
fee_ccy=str(row["fee_ccy"] or row["premium_ccy"] or row_ccy or ""),
|
||||
)
|
||||
pnl = settled.get("realized_pnl")
|
||||
# BTC/ETH:币盈亏可落库;真盈亏U与平仓价等卖回VWAP,禁止用指数占位
|
||||
if row_pc in ("ETH", "BTC"):
|
||||
pnl_usdt = None
|
||||
close_px_store = None
|
||||
else:
|
||||
pnl_usdt = settled.get("realized_pnl_usdt")
|
||||
close_px_store = settled.get("close_index_px")
|
||||
# 真盈亏U=期权币盈亏×平仓价
|
||||
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
|
||||
@@ -537,7 +531,7 @@ def close_option_by_bid1(
|
||||
row_ofee,
|
||||
row_cfee,
|
||||
str(row["premium_ccy"] or row_ccy or premium_ccy or ""),
|
||||
close_px_store,
|
||||
settled.get("close_index_px"),
|
||||
settled.get("open_index_px") or row_open_idx,
|
||||
pnl_usdt,
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user