No latest price for CCXT's fetch_ohlcv API

69 views Asked by At

I am using CCXT's fetch_ohlcv method to get the historical price of the coins. For a trading strategy I need to get the last N number timeframe of price records. Let's say if the timeframe is '15m' and N is 99, if the current time is 00:00, then I will need to extract the records starting from around 23:15 of the previous night. The code would be something like this:

from_ts = exchange.parse8601('2023-12-24 00:00:00')
exchange.fetch_ohlcv('SOLUSDT', '15m', since=from_ts, limit=1000)

But somehow CCXT can only provide around 80 records, which the last couple of hours are missing. I tried Bybit and it is just the same, may I know if certain restriction is applied by CCXT? What is the correct way to extract historic OHLCV records up to the latest moment?

1

There are 1 answers

0
Wonderjimmy On

It turns out I passed a localised time but CCXT handles UTC time, since I am in a GMT+ zone therefore it seems some records are missing.