Polygant / OpenCEX

OpenCEX free open-source cryptocurrency exchange engine. Industry standard.
https://polygant.net/opencex
Apache License 2.0
95 stars 81 forks source link

Trying to insert a new ERC20 token and getting error #28

Open blockchainbrazil opened 10 months ago

blockchainbrazil commented 10 months ago

Traceback (most recent call last): File "manage.py", line 16, in execute_from_command_line(sys.argv) File "/usr/local/lib/python3.8/site-packages/django/core/management/init.py", line 419, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.8/site-packages/django/core/management/init.py", line 413, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv self.execute(*args, *cmd_options) File "/usr/local/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute output = self.handle(args, options) File "/app/cryptocoins/management/commands/add_token.py", line 162, in handle is_price_external = binance_data_source.is_pair_exists(pair_to_usdt) or kucoin_data_source.is_pair_exists( File "/app/cryptocoins/data_sources/crypto.py", line 37, in is_pair_exists binance_client = BinanceClient() File "/usr/local/lib/python3.8/site-packages/binance/client.py", line 300, in init self.ping() File "/usr/local/lib/python3.8/site-packages/binance/client.py", line 526, in ping return self._get('ping', version=self.PRIVATE_API_VERSION) File "/usr/local/lib/python3.8/site-packages/binance/client.py", line 371, in _get return self._request_api('get', path, signed, version, kwargs) File "/usr/local/lib/python3.8/site-packages/binance/client.py", line 334, in _request_api return self._request(method, uri, signed, **kwargs) File "/usr/local/lib/python3.8/site-packages/binance/client.py", line 315, in _request return self._handle_response(self.response) File "/usr/local/lib/python3.8/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.

mo-bay commented 8 months ago

It seems like the issue is occurring due to a restriction imposed by Binance. The traceback indicates that the API request made to Binance's service is being blocked because it's coming from a restricted location.

gnutirt commented 5 months ago

If token, you must check this code

for currency_id in coin_list:
            # if currency_id in [USDT, BTC, TON, DOGE,PEPE,SHIB,FLOKI,MEME,BABYDOGE]:
            if currency_id in [USDT, BTC, TON, DOGE,PEPE,MEME,CAKE]:
                continue

            currency = Currency.get(currency_id)
            if not Keeper.objects.filter(currency=currency).exists():
                k_password, keeper = keeper_create(currency)
                gas_password, gas_keeper = keeper_create(currency, True)
                to_write.append(f'{currency.code} Info')
                to_write.append(f'Keeper address: {keeper.user_wallet.address}, Password: {k_password}')
                to_write.append(f'GasKeeper address: {gas_keeper.user_wallet.address}, Password: {gas_password}')
                to_write.append('='*10)
            else:
                to_write.append(f'{currency.code} Info')
                to_write.append('Keeper and GasKeeper exists, see previous file')
                to_write.append('=' * 10)
EVMBotDev commented 2 months ago

If token, you must check this code

for currency_id in coin_list:
            # if currency_id in [USDT, BTC, TON, DOGE,PEPE,SHIB,FLOKI,MEME,BABYDOGE]:
            if currency_id in [USDT, BTC, TON, DOGE,PEPE,MEME,CAKE]:
                continue

            currency = Currency.get(currency_id)
            if not Keeper.objects.filter(currency=currency).exists():
                k_password, keeper = keeper_create(currency)
                gas_password, gas_keeper = keeper_create(currency, True)
                to_write.append(f'{currency.code} Info')
                to_write.append(f'Keeper address: {keeper.user_wallet.address}, Password: {k_password}')
                to_write.append(f'GasKeeper address: {gas_keeper.user_wallet.address}, Password: {gas_password}')
                to_write.append('='*10)
            else:
                to_write.append(f'{currency.code} Info')
                to_write.append('Keeper and GasKeeper exists, see previous file')
                to_write.append('=' * 10)

What must we check in that code?

cryptoIRAfinance commented 1 month ago

It seems like the issue is occurring due to a restriction imposed by Binance. The traceback indicates that the API request made to Binance's service is being blocked because it's coming from a restricted location.

This is correct. Binance is region locked in many parts of the world. I fixed this by adding additional data sources, and adjust the call logic to ensure data if not call other data source. it's a bit slower initially, but once running no issues.