edeng23 / binance-trade-bot

Automated cryptocurrency trading bot
GNU General Public License v3.0
7.87k stars 2.19k forks source link

APIError(code=0): Service unavailable from a restricted location #512

Open Nesonica opened 1 year ago

Nesonica commented 1 year ago

When running

python3 -m binance_trade_bot

on my Google Cloud Compute Engine I get this error - can someone help me fix it? :

2022-12-25 23:16:38,544 - crypto_trading_logger - INFO - Starting Traceback (most recent call last): File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/naezih/binance-trade-bot/binance_trade_bot/main.py", line 5, in main() File "/home/naezih/binance-trade-bot/binance_trade_bot/crypto_trading.py", line 21, in main manager = BinanceAPIManager.create_manager(config, db, logger) File "/home/naezih/binance-trade-bot/binance_trade_bot/binance_api_manager.py", line 144, in create_manager return BinanceAPIManager._common_factory( File "/home/naezih/binance-trade-bot/binance_trade_bot/binance_api_manager.py", line 135, in _common_factory client = Client( File "/home/naezih/.local/lib/python3.9/site-packages/binance/client.py", line 300, in init self.ping() File "/home/naezih/.local/lib/python3.9/site-packages/binance/client.py", line 526, in ping return self._get('ping', version=self.PRIVATE_API_VERSION) File "/home/naezih/.local/lib/python3.9/site-packages/binance/client.py", line 371, in _get return self._request_api('get', path, signed, version, kwargs) File "/home/naezih/.local/lib/python3.9/site-packages/binance/client.py", line 334, in _request_api return self._request(method, uri, signed, kwargs) File "/home/naezih/.local/lib/python3.9/site-packages/binance/client.py", line 315, in _request return self._handle_response(self.response) File "/home/naezih/.local/lib/python3.9/site-packages/binance/client.py", line 324, in _handle_response raise BinanceAPIException(response, response.status_code, response.text) binance.exceptions.BinanceAPIException: APIError(code=0): Service unavailable from a restricted location according to 'b. Eligibility' in https://www.binance.com/en/terms. Please contact customer service if you believe you received this message in error.

QGB commented 1 year ago

no US IP

oliver-zehentleitner commented 1 year ago

A workaround could be a SOCKS5 proxy: REST: https://medium.lucit.tech/how-to-connect-to-binance-com-rest-api-using-python-via-a-socks5-proxy-638dbbecacfd WS: https://medium.lucit.tech/how-to-connect-to-binance-com-websockets-using-python-via-a-socks5-proxy-3c5a3e063f12