Split fee stats by leg and hide LIVE slip.

SIM shows perp/option fees and slip separately; LIVE keeps real exchange fees only with slip forced to zero.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-29 16:37:18 +08:00
parent 8518a207a7
commit 1c75db4a19
8 changed files with 122 additions and 20 deletions
+6 -6
View File
@@ -555,7 +555,7 @@ class BinanceLiveExecutor(Matcher):
of_px = float(prev["fill_px"])
of_fee = float(prev["fee"] or 0)
of_notional = float(prev["notional"] or (of_px * opt_qty))
of_slip = float(prev["slip"] or 0)
of_slip = 0.0 # LIVE 不计模拟滑点
else:
# 含到期:优先交易所真实平期权;失败且无内在价值时可本地结算
try:
@@ -576,12 +576,12 @@ class BinanceLiveExecutor(Matcher):
of = option_expiry_settle(
intrinsic=float(intrinsic), qty_eth=opt_qty, fee_rate=fee_rate
)
of_px, of_fee, of_slip, of_notional = (
of_px, of_fee, of_notional = (
of.fill_px,
of.fee,
of.slip,
of.notional,
)
of_slip = 0.0 # LIVE 不计模拟滑点
logger.warning(
"expiry option exchange close failed, local settle: %s", e
)
@@ -759,9 +759,9 @@ class BinanceLiveExecutor(Matcher):
g = self.db.fetchone("SELECT * FROM groups WHERE group_id=?", (group_id,))
base_fees = float((g["fees"] if g else 0) or 0)
fees = base_fees + (0.0 if skip_option_cash else of_fee) + pf_fee
slip = float((g["slip_cost"] if g else 0) or 0) + (
0.0 if option_fill_already_written else of_slip
)
# LIVE:真实成交价已含盘口冲击,不另计/不计模拟滑点
of_slip = 0.0
slip = 0.0
from ..sim.pnl import summarize_fills_pnl
with self.db._lock:
+6 -6
View File
@@ -570,7 +570,7 @@ class OkxLiveExecutor(Matcher):
of_px = float(prev["fill_px"])
of_fee = float(prev["fee"] or 0)
of_notional = float(prev["notional"] or (of_px * opt_qty))
of_slip = float(prev["slip"] or 0)
of_slip = 0.0 # LIVE 不计模拟滑点
else:
# 含到期:优先交易所真实平期权;失败且无内在价值时可本地结算
try:
@@ -593,12 +593,12 @@ class OkxLiveExecutor(Matcher):
of = option_expiry_settle(
intrinsic=float(intrinsic), qty_eth=opt_qty, fee_rate=fee_rate
)
of_px, of_fee, of_slip, of_notional = (
of_px, of_fee, of_notional = (
of.fill_px,
of.fee,
of.slip,
of.notional,
)
of_slip = 0.0 # LIVE 不计模拟滑点
logger.warning(
"expiry option exchange close failed, local settle: %s", e
)
@@ -779,9 +779,9 @@ class OkxLiveExecutor(Matcher):
g = self.db.fetchone("SELECT * FROM groups WHERE group_id=?", (group_id,))
base_fees = float((g["fees"] if g else 0) or 0)
fees = base_fees + (0.0 if skip_option_cash else of_fee) + pf_fee
slip = float((g["slip_cost"] if g else 0) or 0) + (
0.0 if option_fill_already_written else of_slip
)
# LIVE:真实成交价已含盘口冲击,不另计/不计模拟滑点
of_slip = 0.0
slip = 0.0
from ..sim.pnl import summarize_fills_pnl
with self.db._lock: