Skip to content

Commit eb8875b

Browse files
committed
feat: adjust okx ohlcv candle limits
1 parent 97578c0 commit eb8875b

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

freqtrade/exchange/okx.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,22 @@ def ohlcv_candle_limit(
6565
"""
6666
Exchange ohlcv candle limit
6767
OKX has the following behaviour:
68-
* 300 candles for up-to-date data
69-
* 100 candles for historic data
70-
* 100 candles for additional candles (not futures or spot).
68+
* spot and futures:
69+
* 300 candles for regular candles
70+
* mark and premium-index:
71+
* 300 candles for up-to-date data
72+
* 100 candles for historic data
73+
* additional data:
74+
* 100 candles for additional candles
7175
:param timeframe: Timeframe to check
7276
:param candle_type: Candle-type
7377
:param since_ms: Starting timestamp
7478
:return: Candle limit as integer
7579
"""
76-
if candle_type in (CandleType.FUTURES, CandleType.SPOT) and (
80+
if candle_type in (CandleType.FUTURES, CandleType.SPOT):
81+
return 300
82+
83+
if candle_type in (CandleType.MARK, CandleType.PREMIUMINDEX) and (
7784
not since_ms or since_ms > (date_minus_candles(timeframe, 300).timestamp() * 1000)
7885
):
7986
return 300

0 commit comments

Comments
 (0)