Bitcoin

Exchanges – Access Kucoin OHLC data from API?

To get the information you want:
I use a variable called kline and the request in json format.
It is as follows:

kline = requests.get(url + '/api/v1/market/candles?type=1min&symbol="+Cry+"&startAt=1566703297&endAt=1566789757')
# Then I convert it to json
kline = kline.json()
# turn that into a dataframe where I pull the data dictionary
kline = pd.DataFrame(kline('data'))
# Then I rename the columbs as so
kline = kline.rename(0:"Time",1:"Open",
                2:"Close",3:"High",4:"Low",5:"Amount",6:"Volume", axis="columns")
# Set the index as time
kline.set_index('Time', inplace=True)
# To assist I will call the head and and print for you
kline.head()
print(kline)

As you can see, once you have a data frame, you can manipulate it however you want.

Related Articles

Back to top button