Skip to content

Commit 5f907d4

Browse files
committed
chore: move candletype check to can_use_websocket.
1 parent c39c5f2 commit 5f907d4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

freqtrade/exchange/exchange.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,7 +2449,11 @@ def _can_use_websocket(
24492449
Check if we can use websocket for this pair.
24502450
Acts as typeguard for exchangeWs
24512451
"""
2452-
if self._has_watch_ohlcv and exchange_ws:
2452+
if (
2453+
self._has_watch_ohlcv
2454+
and exchange_ws
2455+
and candle_type in (CandleType.SPOT, CandleType.FUTURES)
2456+
):
24532457
return True
24542458
return False
24552459

@@ -2462,7 +2466,7 @@ def _build_coroutine(
24622466
cache: bool,
24632467
) -> Coroutine[Any, Any, OHLCVResponse]:
24642468
not_all_data = cache and self.required_candle_call_count > 1
2465-
if cache and candle_type in (CandleType.SPOT, CandleType.FUTURES):
2469+
if cache:
24662470
if self._can_use_websocket(self._exchange_ws, pair, timeframe, candle_type):
24672471
# Subscribe to websocket
24682472
self._exchange_ws.schedule_ohlcv(pair, timeframe, candle_type)

0 commit comments

Comments
 (0)