mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-15 12:22:18 +00:00
chore: move candletype check to can_use_websocket.
This commit is contained in:
@@ -2449,7 +2449,11 @@ class Exchange:
|
|||||||
Check if we can use websocket for this pair.
|
Check if we can use websocket for this pair.
|
||||||
Acts as typeguard for exchangeWs
|
Acts as typeguard for exchangeWs
|
||||||
"""
|
"""
|
||||||
if self._has_watch_ohlcv and exchange_ws:
|
if (
|
||||||
|
self._has_watch_ohlcv
|
||||||
|
and exchange_ws
|
||||||
|
and candle_type in (CandleType.SPOT, CandleType.FUTURES)
|
||||||
|
):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -2462,7 +2466,7 @@ class Exchange:
|
|||||||
cache: bool,
|
cache: bool,
|
||||||
) -> Coroutine[Any, Any, OHLCVResponse]:
|
) -> Coroutine[Any, Any, OHLCVResponse]:
|
||||||
not_all_data = cache and self.required_candle_call_count > 1
|
not_all_data = cache and self.required_candle_call_count > 1
|
||||||
if cache and candle_type in (CandleType.SPOT, CandleType.FUTURES):
|
if cache:
|
||||||
if self._can_use_websocket(self._exchange_ws, pair, timeframe, candle_type):
|
if self._can_use_websocket(self._exchange_ws, pair, timeframe, candle_type):
|
||||||
# Subscribe to websocket
|
# Subscribe to websocket
|
||||||
self._exchange_ws.schedule_ohlcv(pair, timeframe, candle_type)
|
self._exchange_ws.schedule_ohlcv(pair, timeframe, candle_type)
|
||||||
|
|||||||
Reference in New Issue
Block a user