There are a few public methods on Poloniex, all of which take HTTP GET requests and return output in JSON format. I am using Python to asking the chart data of the most current 5-min-periods. I get the response and can work with it, but sometimes it contains null values. Does anybody know why?
Does anybody know a more stable method to do this task? My method is useless if the returned data is null sometimes. Here is my code:
from calendar import timegm
import datetime
import requests
current_time = datetime.datetime.utcnow()
current_unix_time = timegm(current_time.timetuple())
r = requests.get('https://poloniex.com/public?command=returnChartData¤cyPair=USDT_BTC&start=' + str(current_unix_time - 300) + '&end=' + str(current_unix_time) + '&period=300')
print(r.json())
Appreciate any help. Thanks in advance.