Add OKX trading-account USDC auto-swap and lock exit target while in position.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -20,6 +20,12 @@ _LIVE_BAL_TTL_SEC = 8.0
|
||||
_notified_while_short: bool = False
|
||||
|
||||
|
||||
def invalidate_live_balance_cache() -> None:
|
||||
"""兑换/划转后强制下次重拉交易账户余额。"""
|
||||
_live_bal_cache["ts"] = 0.0
|
||||
_live_bal_cache["data"] = None
|
||||
|
||||
|
||||
def _f(v: Any) -> float | None:
|
||||
try:
|
||||
if v is None or v == "":
|
||||
@@ -211,7 +217,7 @@ def maybe_notify_funds_short(cap: dict[str, Any] | None = None) -> None:
|
||||
f"**永续**: {cap.get('perp_label')}",
|
||||
f"**期权**: {cap.get('option_label')}",
|
||||
*[f"**详情**: {p}" for p in parts],
|
||||
"请从资金账户划转到交易账户后重试。",
|
||||
"OKX 开仓前会尝试交易账户市价兑 USDC;仍不足请检查交易账户余额。",
|
||||
],
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user