Route sim transfer and convert through local wallets instead of OKX private API.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-14 18:47:41 +08:00
parent e7aa724a3b
commit 9d1495658c
2 changed files with 145 additions and 8 deletions
+12 -2
View File
@@ -21,6 +21,16 @@ _ACCT_MAP = {
}
def normalize_sim_account(account: str | None) -> str:
"""统一账户别名: swap/unified → trading; spot → funding."""
a = (account or "").strip().lower()
if a in ("trading", "swap", "unified", "18"):
return "trading"
if a in ("funding", "spot", "6"):
return "funding"
return a
class InsufficientFunds(RuntimeError):
pass
@@ -172,8 +182,8 @@ class SimWallets:
if amt <= 0:
return {"ok": False, "detail": "划转金额须大于 0"}
ccy_l = (ccy or "USDT").strip().lower()
fa = (from_account or "").strip().lower()
ta = (to_account or "").strip().lower()
fa = normalize_sim_account(from_account)
ta = normalize_sim_account(to_account)
if fa not in ("funding", "trading") or ta not in ("funding", "trading"):
return {"ok": False, "detail": "账户仅支持 funding / trading"}
if fa == ta: