Fix OKX spot swap tgtCcy and show options trading USDT in header.
OKX requires quote_ccy/base_ccy for market orders; include trading_usdt in balance display and total funds. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -446,8 +446,8 @@ def options_header_balances(
|
||||
ex: ccxt.okx,
|
||||
*,
|
||||
force: bool = False,
|
||||
) -> tuple[float | None, float | None, float | None]:
|
||||
"""顶栏三格:交易 USDC,资金 USDC,资金 USDT(单次拉取 + 缓存)."""
|
||||
) -> tuple[float | None, float | None, float | None, float | None]:
|
||||
"""顶栏四格:交易 USDC/USDT,资金 USDC/USDT(单次拉取 + 缓存)."""
|
||||
bal = fetch_options_balances(ex, force=force)
|
||||
|
||||
def _round(v: Any) -> float | None:
|
||||
@@ -462,6 +462,7 @@ def options_header_balances(
|
||||
_round(bal.get("trading_usdc")),
|
||||
_round(bal.get("funding_usdc")),
|
||||
_round(bal.get("funding_usdt")),
|
||||
_round(bal.get("trading_usdt")),
|
||||
)
|
||||
|
||||
|
||||
@@ -1110,7 +1111,7 @@ def spot_market_swap_usdt_usdc(
|
||||
"side": "buy",
|
||||
"ordType": "market",
|
||||
"sz": str(amount),
|
||||
"tgtCcy": "quote",
|
||||
"tgtCcy": "quote_ccy",
|
||||
}
|
||||
elif d == "usdc_to_usdt":
|
||||
body = {
|
||||
@@ -1119,7 +1120,7 @@ def spot_market_swap_usdt_usdc(
|
||||
"side": "sell",
|
||||
"ordType": "market",
|
||||
"sz": str(amount),
|
||||
"tgtCcy": "base",
|
||||
"tgtCcy": "base_ccy",
|
||||
}
|
||||
else:
|
||||
return {"ok": False, "msg": "direction 须为 usdt_to_usdc 或 usdc_to_usdt"}
|
||||
|
||||
Reference in New Issue
Block a user