env 锁定币本位并清掉对冲/USDC 配置项。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-09-30 23:42:10 +08:00
parent 2352a5fbdf
commit 6f9e6e2a32
6 changed files with 47 additions and 195 deletions
+4 -12
View File
@@ -24,22 +24,14 @@ def _env_float(name: str, default: float) -> float:
def normalize_options_margin_mode(raw: Any = None) -> str:
"""返回 usdc | coin;未配置时默认币本位."""
if raw is None:
raw = os.getenv("OKX_OPTIONS_MARGIN_MODE")
v = str(raw or MODE_COIN).strip().lower()
if v in ("usdc", "usdc_margin", "usd_margin", "u本位", "u"):
return MODE_USDC
if v in ("coin", "coin_margin", "crypto", "crypto_margin", "币本位"):
return MODE_COIN
# 空串或未知值:默认币本位
if not v:
return MODE_COIN
"""币本位专用机:始终 coin;历史 usdc 配置读取时亦归一为 coin."""
del raw
return MODE_COIN
def is_coin_margin_mode(raw: Any = None) -> bool:
return normalize_options_margin_mode(raw) == MODE_COIN
del raw
return True
def inst_family_for_underlying(underlying: str, *, margin_mode: str | None = None) -> str: