guldo111 / triangular-arbitrage-bot-multi-exchange

Triangular Arbitrage Bot automates profitable cryptocurrency trading by scanning for price discrepancies across exchanges and executing trades to exploit arbitrage opportunities on popular cryptocurrency exchanges such as Binance, Kucoin, OKEx, and Huobi.
MIT License
9 stars 7 forks source link

python-telegram-bot Changed in version 20.x #1

Open dima-online opened 8 months ago

dima-online commented 8 months ago

Script send error:


    updater = Updater(bot_token)                                                                                                                                                                                               ^^^^^^^^^^^^^^^^^^ 
TypeError: Updater.__init__() missing 1 required positional argument: 'update_queue'
guldo111 commented 8 months ago

Hi,
The error you're encountering is due to a change in the 'python-telegram-bot' API.

A temporary solution to get the code working again is to install an older version of the library using the following pip command:

pip install python-telegram-bot==13.3

I will update the code as soon as I have time.

dima-online commented 8 months ago

In this case another error appears:

Traceback (most recent call last):                                                                        

    from .packages.six.moves.http_client import (

ModuleNotFoundError: No module named 'telegram.vendor.ptb_urllib3.urllib3.packages.six.moves'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

    import urllib3.contrib.appengine as appengine  # type: ignore[no-redef]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'urllib3.contrib.appengine'
guldo111 commented 8 months ago

Strange, i have tried to run it right now and it's working on my end. Have you completely uninstalled python-telegram-bot library pip uninstall python-telegram-bot ?

then could you please try the following commands and let me know

pip install six --upgrade pip install urllib3 --upgrade pip uninstall python-telegram-bot pip install python-telegram-bot==13.3

dima-online commented 8 months ago
Package             Version
------------------- ------------
aiodns              3.1.1
aiohttp             3.9.0b0
aiosignal           1.3.1
APScheduler         3.6.3
attrs               23.1.0
ccxt                4.1.36
certifi             2023.7.22
cffi                1.16.0
charset-normalizer  3.3.2
cryptography        41.0.5
frozenlist          1.4.0
idna                3.4
multidict           6.0.4
numpy               1.26.1
pandas              2.1.2
pip                 23.3.1
pycares             4.4.0
pycparser           2.21
python-dateutil     2.8.2
python-dotenv       1.0.0
python-telegram-bot 13.3
pytz                2023.3.post1
requests            2.31.0
setuptools          68.2.2
six                 1.16.0
tornado             6.3.3
tzdata              2023.3
tzlocal             5.2
urllib3             2.0.7
yarl                1.9.2
dima-online commented 8 months ago

Also pandas.DataFrame.append is deprecated since version 1.4.0

cnandez12 commented 5 months ago

Greetings to the developer, I tried to test the tool but there are problems with the PANDAS library, it cannot interact with the CSV file

guldo111 commented 5 months ago

Hi, could you please explain in more details the error? also the traceback will be useful

cnandez12 commented 5 months ago

An error occurred: No columns to parse from file Traceback (most recent call last): File "c:\Users\Administrator\Desktop\triangular-arbitrage-bot-multi-exchange-main\Pruebas.py", line 490, in main await asyncio.gather( File "c:\Users\Administrator\Desktop\triangular-arbitrage-bot-multi-exchange-main\Pruebas.py", line 217, in find_triangular_arbitrage_opportunities df = pd.read_csv(csv_file) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\io\parsers\readers.py", line 1024, in read_csv return _read(filepath_or_buffer, kwds) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\io\parsers\readers.py", line 618, in _read parser = TextFileReader(filepath_or_buffer, kwds) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\io\parsers\readers.py", line 1618, in init self._engine = self._make_engine(f, self.engine) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\io\parsers\readers.py", line 1896, in _make_engine return mapping[engine](f, self.options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\io\parsers\c_parser_wrapper.py", line 93, in init self._reader = parsers.TextReader(src, **kwds) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "parsers.pyx", line 581, in pandas._libs.parsers.TextReader.cinit pandas.errors.EmptyDataError: No columns to parse from file

This is the error that is printed by the console when running the application

cnandez12 commented 5 months ago

It seems that it cannot format the CSV file with the necessary columns for reading and writing, Thanks for answering

TestGithub2024m commented 3 months ago

i altered the main script with this function because i had the same error and it fixed the issue.

async def find_triangular_arbitrage_opportunities(exchange, markets, tickers, exchange_name, fee, initial_amount): logging.info('Finding arbitrage opportunities.')

Read existing trades from CSV file

csv_file = 'tri_arb_opportunities.csv'

try:
    if os.path.exists(csv_file) and os.path.getsize(csv_file) > 0:
        df = pd.read_csv(csv_file)
        tri_arb_opportunities = df.to_dict('records')
    else:
        tri_arb_opportunities = []
except pd.errors.EmptyDataError:
    logging.warning('CSV file is empty. No arbitrage opportunities.')
    tri_arb_opportunities = []

# Add a new variable to keep track of the last time a trade was added to the CSV file for each trading pair
last_trade_time = {}

An error occurred: No columns to parse from file Traceback (most recent call last): File "c:\Users\Administrator\Desktop\triangular-arbitrage-bot-multi-exchange-main\Pruebas.py", line 490, in main await asyncio.gather( File "c:\Users\Administrator\Desktop\triangular-arbitrage-bot-multi-exchange-main\Pruebas.py", line 217, in find_triangular_arbitrage_opportunities df = pd.read_csv(csv_file) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\io\parsers\readers.py", line 1024, in read_csv return _read(filepath_or_buffer, kwds) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\io\parsers\readers.py", line 618, in _read parser = TextFileReader(filepath_or_buffer, kwds) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\io\parsers\readers.py", line 1618, in init self._engine = self._make_engine(f, self.engine) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\io\parsers\readers.py", line 1896, in _make_engine return mapping[engine](f, self.options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas\io\parsers\c_parser_wrapper.py", line 93, in init self._reader = parsers.TextReader(src, kwds) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "parsers.pyx", line 581, in pandas._libs.parsers.TextReader.cinit** pandas.errors.EmptyDataError: No columns to parse from file

This is the error that is printed by the console when running the application