Fix option UPL to bid times size minus initial premium.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -469,7 +469,6 @@ class Matcher:
|
||||
oq = snap.call if option_side == "call" else snap.put
|
||||
initial_premium = float(pos["initial_premium"] or 0)
|
||||
option_upl = 0.0
|
||||
option_econ = 0.0 # 真实经济盈亏:买一市值 − 开仓权利金
|
||||
est_opt_close_fee = 0.0
|
||||
opt_mark = None
|
||||
if oq and oq.bid is not None:
|
||||
@@ -483,18 +482,16 @@ class Matcher:
|
||||
)
|
||||
est_opt_close_fee = of.fee
|
||||
opt_mark = bid
|
||||
# 浮盈亏展示:初始权利金 − 买一×数量
|
||||
option_upl = initial_premium - bid * opt_qty
|
||||
option_econ = bid * opt_qty - initial_premium
|
||||
# 浮盈亏:买一×数量 − 初始权利金
|
||||
option_upl = bid * opt_qty - initial_premium
|
||||
elif oq:
|
||||
opt_mark = oq.bid or oq.mark_px
|
||||
if opt_mark is not None:
|
||||
option_upl = initial_premium - float(opt_mark) * opt_qty
|
||||
option_econ = float(opt_mark) * opt_qty - initial_premium
|
||||
option_upl = float(opt_mark) * opt_qty - initial_premium
|
||||
|
||||
est_close_fees = est_perp_close_fee + est_opt_close_fee
|
||||
# 净盈利用经济口径(含预估平仓费);期权浮盈亏字段单独按权利金−买一市值
|
||||
net_pnl = perp_upl + option_econ - est_close_fees
|
||||
# 净盈利:永续浮盈 + 期权浮盈 − 预估平仓手续费
|
||||
net_pnl = perp_upl + option_upl - est_close_fees
|
||||
|
||||
entry_idx = float(pos["entry_index_px"] or 0)
|
||||
move = abs(float(index_px) - entry_idx) if index_px is not None and entry_idx else 0.0
|
||||
|
||||
Reference in New Issue
Block a user