aCallum / SafePi

SafePi is a Python based tracking tool for Safemoon, aimed to be run on a Raspberry Pi with GPIO displays.
27 stars 5 forks source link

Error on launch #11

Open threepoint2 opened 3 years ago

threepoint2 commented 3 years ago

Traceback (most recent call last): File "main.py", line 110, in update_data() File "main.py", line 108, in update_data currentPerc = (float)(ticker['info']['percentChange']) KeyError: 'percentChange'

threepoint2 commented 3 years ago

Comment out the currentPerc command and it works so not sure why it does not like percentChange on ccxt.

ghost commented 2 years ago

There is an easy solution: Create: def get_percent_change(): url = "https://data.gateapi.io/api2/1/ticker/safemoon_usdt" return (float)(requests.get(url).json()["percentChange"])

Then change: currentPerc = (float)(ticker['info']['percentChange']) to currentPerc = get_percent_change()

threepoint2 commented 2 years ago

100% working, thank you