0

I'm trying to get Klines historical data from a specific time (4th of April of 2022) of the futures Bitcoin market (which has the symbol '.KXBTUSDT'). However when I call the function the API returns an empty array. Furthermore, when I call the get_kline_data function without specifying an end or start time everything works well.

Here is the code :

client = Market(url='https://api-futures.kucoin.com')
kline = client.get_kline_data('.KXBTUSDT', 1, 1648845540000, 1648846800000)
print(kline)

Here is the output :

{'code': '200000', 'data': []}

The fact that the code is equal to 20000 shows that the request was successful, that's why I don't understand how data can be empty.

Would any of you know how to fix this problem ? Thanks in advance.

Quents
  • 13
  • 3
  • what library are you using? – Alex B Jun 05 '22 at 17:19
  • @AlexB hi, thanks for your answer, I'm using the python library developed by Kucoin : https://docs.kucoin.com/futures/#general. So I actually agree that the solution you gave works with CCXT but I need to make it work with the KuCoin API. – Quents Jul 17 '22 at 13:57

2 Answers2

0

Here is a quick way to retrieve the data using CCXT library:

import ccxt

exchange = ccxt.kucoinfutures()
markets = exchange.fetchMarkets()
symbol = 'BTC/USDT:USDT'
kline = exchange.fetchOHLCV(symbol, timeframe = '1m', since = 1648845540000, limit = 1648846800000, params = {})
print(kline)
Alex B
  • 1,092
  • 1
  • 14
  • 39
0

I could be wrong, but I think Kucoin Futures limits its data to the last day or two. Your request is correct, but it's not returning any data because it has a lookback longer than what's available. Someone, please correct me if I am wrong.