Skip to content

Commit dbb9f22

Browse files
committed
fix: Runtime error on ohlcv deepcopy
closes freqtrade#11335
1 parent 85753be commit dbb9f22

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

freqtrade/exchange/exchange_ws.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
from freqtrade.constants import Config, PairWithTimeframe
1111
from freqtrade.enums.candletype import CandleType
12+
from freqtrade.exceptions import TemporaryError
13+
from freqtrade.exchange.common import retrier
1214
from freqtrade.exchange.exchange import timeframe_to_seconds
1315
from freqtrade.exchange.exchange_types import OHLCVResponse
1416
from freqtrade.util import dt_ts, format_ms_time, format_ms_time_det
@@ -83,13 +85,18 @@ def _pop_history(self, paircomb: PairWithTimeframe) -> None:
8385
"""
8486
self._ccxt_object.ohlcvs.get(paircomb[0], {}).pop(paircomb[1], None)
8587

88+
@retrier(retries=3)
8689
def ohlcvs(self, pair: str, timeframe: str) -> list[list]:
8790
"""
8891
Returns a copy of the klines for a pair/timeframe combination
8992
Note: this will only contain the data received from the websocket
9093
so the data will build up over time.
9194
"""
92-
return deepcopy(self._ccxt_object.ohlcvs.get(pair, {}).get(timeframe, []))
95+
try:
96+
return deepcopy(self._ccxt_object.ohlcvs.get(pair, {}).get(timeframe, []))
97+
except RuntimeError as e:
98+
# Capture runtime errors and retry
99+
raise TemporaryError(f"Error deepcopying: {e}") from e
93100

94101
def cleanup_expired(self) -> None:
95102
"""

0 commit comments

Comments
 (0)