3commas-cyber-bots: Error fetching 3Commas price
Describe the bug When using altrank.py script, fetching BTC price from 3commas fails on:
2022-11-03 10:44:36 - altrank - INFO - 3C Cyber Bot-Helper altrank
2022-11-03 10:44:36 - altrank - INFO - Started on Thursday 10:44:36 2022-11-03
2022-11-03 10:44:36 - altrank - INFO - Notifications are enabled
2022-11-03 10:44:36 - altrank - INFO - Loaded configuration from '/root/3commas-cyber-bots/altrank.ini'
2022-11-03 10:44:36 - altrank - INFO - Reloaded configuration from '/root/3commas-cyber-bots/altrank.ini'
2022-11-03 10:44:36 - altrank - INFO - Fetched 3Commas pairs blacklist OK (7 pairs)
2022-11-03 10:44:36 - altrank - INFO - Fetched 3Commas price OK (20311.34)
Traceback (most recent call last):
File ".../3commas-cyber-bots/./altrank.py", line 360, in <module>
usdtbtcprice = get_threecommas_btcusd(logger, api)
File ".../3commas-cyber-bots/helpers/threecommas.py", line 74, in get_threecommas_btcusd
if isnan(price):
TypeError: must be real number, not str
To Reproduce
git pullto get latest version- instal missing requirements if any
- run
altrank.py
Expected behavior Should run flawlessly
Environment:
- Python version: 3.9.7
- Operating System: Ubuntu
- Version of software: latest
How to fix
I simply fixed the script by adding typecheck and converting string to float (I am not a python developer TBH):
File: helpers/threecommas.py
Edit:
...
if data:
price = data["last"]
logger.info(f"Fetched 3Commas price OK ({price})")
if isinstance(price, str): # <-- NEW CODE
price = float(price) # <-- NEW CODE
else:
...
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 30 (13 by maintainers)
yeah you are right. Debug is on now, and it seems altrank and vol limits are too high. I will post results.
It seems to have downloaded data, maybe something else needs a fix
Fetched LunarCrush ranking OK (150 coins)Ah yes you are right. I missed in the overview the credits part and saw only the number of calls you are allowed to do per day.