|
9 | 9 |
|
10 | 10 | from freqtrade.constants import Config, PairWithTimeframe |
11 | 11 | from freqtrade.enums.candletype import CandleType |
| 12 | +from freqtrade.exceptions import TemporaryError |
| 13 | +from freqtrade.exchange.common import retrier |
12 | 14 | from freqtrade.exchange.exchange import timeframe_to_seconds |
13 | 15 | from freqtrade.exchange.exchange_types import OHLCVResponse |
14 | 16 | from freqtrade.util import dt_ts, format_ms_time, format_ms_time_det |
@@ -83,13 +85,18 @@ def _pop_history(self, paircomb: PairWithTimeframe) -> None: |
83 | 85 | """ |
84 | 86 | self._ccxt_object.ohlcvs.get(paircomb[0], {}).pop(paircomb[1], None) |
85 | 87 |
|
| 88 | + @retrier(retries=3) |
86 | 89 | def ohlcvs(self, pair: str, timeframe: str) -> list[list]: |
87 | 90 | """ |
88 | 91 | Returns a copy of the klines for a pair/timeframe combination |
89 | 92 | Note: this will only contain the data received from the websocket |
90 | 93 | so the data will build up over time. |
91 | 94 | """ |
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 |
93 | 100 |
|
94 | 101 | def cleanup_expired(self) -> None: |
95 | 102 | """ |
|
0 commit comments