"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(binance): acknowledge all-symbol open-order request weight
Haozhe Wu0e699790256d
diff --git a/agent/src/trading/connectors/binance/sdk.py b/agent/src/trading/connectors/binance/sdk.pyindex e5f30d76f..c8b3c6355 100644--- a/agent/src/trading/connectors/binance/sdk.py+++ b/agent/src/trading/connectors/binance/sdk.py@@ -813,6 +813,11 @@ def _exchange(cfg: BinanceConfig):"recvWindow": 10_000,},}+ if cfg.market_type == "spot":+ # This read deliberately lists every symbol. Acknowledge CCXT's+ # client-side weight warning; its rate limiter remains enabled and+ # real exchange/auth/network failures still propagate to the caller.+ client_config["options"]["fetchOpenOrders"] = {"warnWithoutSymbol": False}# ``requests``/ccxt does not consistently inherit the macOS System Proxy.# urllib resolves both conventional proxy environment variables and the# active macOS network proxy, so local desktop connectors follow the samediff --git a/agent/tests/test_binance_open_orders.py b/agent/tests/test_binance_open_orders.pynew file mode 100644index 000000000..b6a584730--- /dev/null+++ b/agent/tests/test_binance_open_orders.py@@ -0,0 +1,47 @@+"""Exercise the real CCXT all-symbol guard without calling a broker (#2090)."""++import ccxt+import pytest++from src.trading.connectors.binance import sdk+++def exchange(monkeypatch):+ monkeypatch.setattr(sdk, "getproxies", lambda: {})+ client = sdk._exchange(sdk.BinanceConfig())+ client.set_markets([{+ "id": "BTCUSDT", "symbol": "BTC/USDT", "base": "BTC", "quote": "USDT",+ "type": "spot", "spot": True, "swap": False, "future": False,+ "option": False, "contract": False, "linear": None, "inverse": None,+ }])+ monkeypatch.setattr(sdk, "_exchange", lambda _config: client)+ return client+++def test_all_symbol_read_reaches_the_endpoint_and_returns_the_resting_order(exchange, monkeypatch):+ calls = []++ def read(params):+ calls.append(params)+ return [{"symbol": "BTCUSDT", "orderId": 17, "price": "100.0", "origQty": "1.0",+ "executedQty": "0.0", "status": "NEW", "side": "BUY", "type": "LIMIT",+ "time": 1700000000000}]++ monkeypatch.setattr(exchange, "privateGetOpenOrders", read)+ result = sdk.get_open_orders(sdk.BinanceConfig())+ assert calls == [{}]+ assert len(result["open_orders"]) == 1+ assert result["open_orders"][0]["order_id"] == "17"+ assert result["open_orders"][0]["symbol"] == "BTC/USDT"+ assert exchange.enableRateLimit is True++[email protected]("error", [ccxt.AuthenticationError, ccxt.NetworkError, ccxt.RateLimitExceeded, ccxt.ExchangeError])+def test_real_read_failures_are_not_reported_as_an_empty_order_book(exchange, monkeypatch, error):+ def read(_params):+ raise error("synthetic broker failure")++ monkeypatch.setattr(exchange, "privateGetOpenOrders", read)+ with pytest.raises(error, match="synthetic broker failure"):+ sdk.get_open_orders(sdk.BinanceConfig())diff --git a/agent/tests/test_sdk_connectors.py b/agent/tests/test_sdk_connectors.pyindex 2aa9e9558..e3e057dd8 100644--- a/agent/tests/test_sdk_connectors.py+++ b/agent/tests/test_sdk_connectors.py@@ -800,6 +800,7 @@ def test_binance_exchange_adjusts_for_server_time(monkeypatch) -> None:assert captured["options"] == {"adjustForTimeDifference": True,"recvWindow": 10_000,+ "fetchOpenOrders": {"warnWithoutSymbol": False},}assert captured["sandbox"] is False