Closed ashkan957 closed 1 month ago
It seems that your computer is not able to reach binance.com.
@ashkan957 Binance.com is blocked in the United States. I am currently working on integrating some other central exchange market data that allows for American users to utilize the repo.
In addition to my previous issue that I just posted, when I changed the exchange id to "binance", it gave me such error:
Traceback (most recent call last): File "C:\Users\User\Desktop\Triangular-Arbitrage_1.0.4.venv\Lib\site-packages\ccxt\async_support\base\exchange.py", line 199, in fetch async with session_method(yarl.URL(url, encoded=True), File "C:\Users\User\Desktop\Triangular-Arbitrage_1.0.4.venv\Lib\site-packages\aiohttp\client.py", line 1197, in aenter self._resp = await self._coro ^^^^^^^^^^^^^^^^ File "C:\Users\User\Desktop\Triangular-Arbitrage_1.0.4.venv\Lib\site-packages\aiohttp\client.py", line 507, in _request with timer: File "C:\Users\User\Desktop\Triangular-Arbitrage_1.0.4.venv\Lib\site-packages\aiohttp\helpers.py", line 735, in exit raise asyncio.TimeoutError from None TimeoutError
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "C:\Users\User\Desktop\Triangular-Arbitrage_1.0.4\main.py", line 17, in
best_opportunities, best_profit = asyncio.run(detector.run_detection(exchange_name))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\asyncio\base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\User\Desktop\Triangular-Arbitrage_1.0.4\triangular_arbitrage\detector.py", line 113, in run_detection
last_prices = await get_exchange_last_prices(exchange_name, ignored_symbols or [])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\Desktop\Triangular-Arbitrage_1.0.4\triangular_arbitrage\detector.py", line 108, in get_exchange_last_prices
tickers, exchange_time = await get_exchange_data(exchange_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\Desktop\Triangular-Arbitrage_1.0.4\triangular_arbitrage\detector.py", line 102, in get_exchange_data
tickers = await fetch_tickers(exchange)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\Desktop\Triangular-Arbitrage_1.0.4\triangular_arbitrage\detector.py", line 20, in fetch_tickers
return await exchange.fetch_tickers() if exchange.has['fetchTickers'] else []
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\Desktop\Triangular-Arbitrage_1.0.4.venv\Lib\site-packages\ccxt\async_support\binance.py", line 4002, in fetch_tickers
await self.load_markets()
File "C:\Users\User\Desktop\Triangular-Arbitrage_1.0.4.venv\Lib\site-packages\ccxt\async_support\base\exchange.py", line 276, in load_markets
raise e
File "C:\Users\User\User\Triangular-Arbitrage_1.0.4.venv\Lib\site-packages\ccxt\async_support\base\exchange.py", line 272, in load_markets
result = await self.markets_loading
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\Desktop\Triangular-Arbitrage_1.0.4.venv\Lib\site-packages\ccxt\async_support\base\exchange.py", line 262, in load_markets_helper
markets = await self.fetch_markets(params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\Desktop\Triangular-Arbitrage_1.0.4.venv\Lib\site-packages\ccxt\async_support\binance.py", line 2831, in fetch_markets promises = await asyncio.gather(*promisesRaw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\Desktop\Triangular-Arbitrage_1.0.4.venv\Lib\site-packages\ccxt\async_support\binance.py", line 10333, in request response = await self.fetch2(path, api, method, params, headers, body, config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\Desktop\Triangular-Arbitrage_1.0.4.venv\Lib\site-packages\ccxt\async_support\base\exchange.py", line 813, in fetch2 return await self.fetch(request['url'], request['method'], request['headers'], request['body']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\User\Desktop\Triangular-Arbitrage_1.0.4.venv\Lib\site-packages\ccxt\async_support\base\exchange.py", line 233, in fetch raise RequestTimeout(details) from e ccxt.base.errors.RequestTimeout: binance GET https://dapi.binance.com/dapi/v1/exchangeInfo binance requires to release all resources with an explicit call to the .close() coroutine. If you are using the exchange instance with async coroutines, add
aw ait exchange.close()
to your code into a place when you're done with the exchange and don't need the exchange instance anymore (at the end of your async coroutine). Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x00000212B3F84FB0>I'd appreciate your help regarding this one, too. Thanks