Add Binance live trading, anti-stuck open/close recovery, and configurable rate limits.

OKX/Binance LIVE share half_open and option_closed_perp_pending repair paths; private REST throttles default to 1s and are tunable in settings.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-26 21:35:10 +08:00
parent e666230d0b
commit dbc86a1ce6
23 changed files with 2381 additions and 385 deletions
+6 -6
View File
@@ -49,22 +49,22 @@ def test_live_ready_okx_missing_keys(monkeypatch) -> None:
assert "OKX" in reason
def test_live_ready_binance_stub(monkeypatch) -> None:
def test_live_ready_binance_ok(monkeypatch) -> None:
import app.env_store as es
class S:
mode = "LIVE"
is_sim = False
okx_api_key = "k"
okx_api_secret = "s"
okx_api_passphrase = "p"
okx_api_key = ""
okx_api_secret = ""
okx_api_passphrase = ""
binance_api_key = "bk"
binance_api_secret = "bs"
monkeypatch.setattr(es, "get_settings", lambda: S())
ok, reason = live_ready(exchange="binance")
assert ok is False
assert "尚未接入" in reason
assert ok is True
assert reason == "ok"
def test_okx_keys_configured(monkeypatch) -> None: