ImDakshitha / Insight-Trader

A python based API development platform to grab, manipulate and back test Cryptocurrency futures markets
1 stars 0 forks source link

IndexError: list index out of range #1

Open dekacypher opened 1 year ago

dekacypher commented 1 year ago

I get this error when i run the code i've created do_not_share.py with the API_KEY as follows:

API_KEY = <my_api_key>

I've tried printing the list, please help.

oi=requests.get(f"https://api.coinalyze.net/v1/open-interest-history?symbols={symbol}&interval={interval}&from={startTime}&to={endTime}",headers={'api_key': API_KEY})

Traceback (most recent call last): File "/Users/dekahalane/Documents/GitHub/Crypto-Breakout-Bot/open-interest-history/coinalyze.py", line 49, in oihistory=oi.json()[0]

ImDakshitha commented 1 year ago

Usually coinalyze stores data for last 30 days if the data requested are beyond 30 days this error occurs.

So change the requested data starting time and ending time to a time interval within last 30 days

st=(datetime.datetime(2023, 7, 17, 0, 0))
et=(datetime.datetime(2023, 7, 27, 0, 0))

Extra note - if you are interested about open interest data only, grab them from binance futures API.But it only offers open interest data from 5min interval onwards but coinalyze offers other insights like liquidations, funding rates, predicted funding rates etc. from 1 min onwards.