feat: adjust okx ohlcv candle limits

This commit is contained in:
Matthias
2025-09-09 07:06:42 +02:00
parent 97578c0831
commit eb8875b64b

View File

@@ -65,15 +65,22 @@ class Okx(Exchange):
""" """
Exchange ohlcv candle limit Exchange ohlcv candle limit
OKX has the following behaviour: OKX has the following behaviour:
* 300 candles for up-to-date data * spot and futures:
* 100 candles for historic data * 300 candles for regular candles
* 100 candles for additional candles (not futures or spot). * mark and premium-index:
* 300 candles for up-to-date data
* 100 candles for historic data
* additional data:
* 100 candles for additional candles
:param timeframe: Timeframe to check :param timeframe: Timeframe to check
:param candle_type: Candle-type :param candle_type: Candle-type
:param since_ms: Starting timestamp :param since_ms: Starting timestamp
:return: Candle limit as integer :return: Candle limit as integer
""" """
if candle_type in (CandleType.FUTURES, CandleType.SPOT) and ( if candle_type in (CandleType.FUTURES, CandleType.SPOT):
return 300
if candle_type in (CandleType.MARK, CandleType.PREMIUMINDEX) and (
not since_ms or since_ms > (date_minus_candles(timeframe, 300).timestamp() * 1000) not since_ms or since_ms > (date_minus_candles(timeframe, 300).timestamp() * 1000)
): ):
return 300 return 300