下线永续监控与 USDC 期权,仅保留币本位期权路径。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-07 12:32:01 +08:00
parent 1a4eb15109
commit 7c5a6e25b2
10 changed files with 1581 additions and 2228 deletions
+11 -17
View File
@@ -642,29 +642,23 @@ def _try_open_full(
inst_id: str,
order: dict[str, Any],
) -> dict[str, Any]:
from lib.options.options_margin_mode_lib import is_coin_margin_mode
from lib.options.options_coin_open_lib import open_coin_option_buy_full
note = f"中控条件单:{order.get('hub_order_id')}"
target_index = _safe_float(order.get("target_index"))
pe_en = bool(order.get("profit_exit_enabled"))
pe_mult = float(order.get("profit_exit_mult") or 1.0)
if is_coin_margin_mode():
return open_coin_option_buy_full(
cfg,
ex,
inst_id=inst_id,
signal_note=note,
target_index=target_index,
profit_exit_enabled=pe_en,
profit_exit_mult=pe_mult,
target_sheets=None,
)
return {
"ok": False,
"msg": "条件单开仓当前仅支持币本位客户端规则(买币→开仓)",
"need_depth": False,
}
# USDC 期权开仓已下线,条件单仅走币本位
return open_coin_option_buy_full(
cfg,
ex,
inst_id=inst_id,
signal_note=note,
target_index=target_index,
profit_exit_enabled=pe_en,
profit_exit_mult=pe_mult,
target_sheets=None,
)
def run_cond_orders_tick(
+7 -7
View File
@@ -35,11 +35,10 @@ def is_coin_margin_mode(raw: Any = None) -> bool:
def inst_family_for_underlying(underlying: str, *, margin_mode: str | None = None) -> str:
"""仅币本位期权族 {U}-USD;USD_UM 已下线."""
del margin_mode
u = (underlying or "ETH").strip().upper() or "ETH"
mode = normalize_options_margin_mode(margin_mode)
if mode == MODE_COIN:
return f"{u}-USD"
return f"{u}-USD_UM"
return f"{u}-USD"
def margin_mode_from_inst_id(inst_id: str) -> str:
@@ -55,9 +54,10 @@ def margin_mode_from_inst_id(inst_id: str) -> str:
def premium_ccy_for_mode(margin_mode: str, underlying: str = "ETH") -> str:
if normalize_options_margin_mode(margin_mode) == MODE_COIN:
return (underlying or "ETH").strip().upper() or "ETH"
return "USDC"
"""币本位权利金为标的币;历史 USDC 行(margin_mode=usdc)仍标 USDC."""
if str(margin_mode or "").strip().lower() == MODE_USDC:
return "USDC"
return (underlying or "ETH").strip().upper() or "ETH"
def spot_quote_inst_id(underlying: str) -> str:
File diff suppressed because it is too large Load Diff