Fix btc_eth watching entry, preview sizing, and coin-to-U settlement.

Use dual indices for watch/preview; perp entry uses ETH mark; expiry/close convert coin PnL via option index; align legacy long→Call; omit combo U when index missing.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-14 21:52:20 +08:00
parent 450296e04b
commit a841c8f31b
8 changed files with 296 additions and 72 deletions
@@ -313,9 +313,8 @@ def build_live_hedge_cards(cfg: dict[str, Any], conn: Any) -> list[dict[str, Any
round(opt_net_coin * float(idx), 4) if idx is not None and idx > 0 else None
)
perp_net = float(net.get("perp_net") or 0)
# 指数缺失时禁止用永续 U 冒充组合净利(尤其跨币会丢掉期权腿)
combo_usdt = combo_net_usdt(net, option_index=float(idx or 0))
if combo_usdt is None:
combo_usdt = round(perp_net, 4)
prem_coin = float(net.get("premium") or (float(avg_open or 0) * float(sheets or 0) * float(ct or 0.01)))
prem_usdt = round(prem_coin * float(idx), 2) if idx is not None and idx > 0 else None
@@ -393,7 +392,11 @@ def build_live_hedge_cards(cfg: dict[str, Any], conn: Any) -> list[dict[str, Any
"net_usdt": combo_usdt,
"opt_net_usdt": opt_net_usdt,
"perp_net_usdt": perp_net,
"note": "扣开平双边手续费;永续按盘口均价估",
"note": (
"期权指数缺失,组合净利暂不可算"
if combo_usdt is None
else "扣开平双边手续费;永续按盘口均价估"
),
},
}
)