单笔期权默认改为币本位;未配置时按coin处理
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -24,13 +24,18 @@ def _env_float(name: str, default: float) -> float:
|
||||
|
||||
|
||||
def normalize_options_margin_mode(raw: Any = None) -> str:
|
||||
"""返回 usdc | coin."""
|
||||
"""返回 usdc | coin;未配置时默认币本位."""
|
||||
if raw is None:
|
||||
raw = os.getenv("OKX_OPTIONS_MARGIN_MODE")
|
||||
v = str(raw or MODE_USDC).strip().lower()
|
||||
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
|
||||
return MODE_USDC
|
||||
# 空串或未知值:默认币本位
|
||||
if not v:
|
||||
return MODE_COIN
|
||||
return MODE_COIN
|
||||
|
||||
|
||||
def is_coin_margin_mode(raw: Any = None) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user