feat: options UI scroll layout, stats card, funding balance, and cross-account transfer
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -489,6 +489,14 @@ def fetch_options_trading_usdc(ex: ccxt.okx) -> float | None:
|
||||
return round(float(v), 2)
|
||||
|
||||
|
||||
def fetch_options_funding_usdc(ex: ccxt.okx) -> float | None:
|
||||
bal = fetch_options_balances(ex)
|
||||
v = bal.get("funding_usdc")
|
||||
if v is None:
|
||||
return None
|
||||
return round(float(v), 2)
|
||||
|
||||
|
||||
def spot_market_swap_usdt_usdc(
|
||||
ex: ccxt.okx,
|
||||
*,
|
||||
@@ -538,7 +546,8 @@ def transfer_main_sub_account(
|
||||
amount: float,
|
||||
sub_acct: str,
|
||||
main_to_sub: bool,
|
||||
account: str = "funding",
|
||||
from_account: str = "funding",
|
||||
to_account: str = "funding",
|
||||
) -> dict[str, Any]:
|
||||
"""主账户与子账户之间划转(须主账户 API)。"""
|
||||
if amount <= 0:
|
||||
@@ -546,15 +555,16 @@ def transfer_main_sub_account(
|
||||
sub = (sub_acct or "").strip()
|
||||
if not sub:
|
||||
return {"ok": False, "msg": "未配置子账户名称 OKX_SUB_ACCOUNT_NAME"}
|
||||
acct_code = _OKX_ACCT_CODE.get((account or "funding").lower(), "6")
|
||||
from_code = _OKX_ACCT_CODE.get((from_account or "funding").lower(), "6")
|
||||
to_code = _OKX_ACCT_CODE.get((to_account or "funding").lower(), "6")
|
||||
try:
|
||||
resp = ex.private_post_asset_transfer(
|
||||
{
|
||||
"type": "1" if main_to_sub else "2",
|
||||
"ccy": str(ccy).upper(),
|
||||
"amt": str(amount),
|
||||
"from": acct_code,
|
||||
"to": acct_code,
|
||||
"from": from_code,
|
||||
"to": to_code,
|
||||
"subAcct": sub,
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user