chore: add wrapper for ws ohlcvs
this avoids access to internal objects
This commit is contained in:
@@ -2397,7 +2397,7 @@ class Exchange:
|
|||||||
if self._exchange_ws:
|
if self._exchange_ws:
|
||||||
candle_ts = dt_ts(timeframe_to_prev_date(timeframe))
|
candle_ts = dt_ts(timeframe_to_prev_date(timeframe))
|
||||||
prev_candle_ts = dt_ts(date_minus_candles(timeframe, 1))
|
prev_candle_ts = dt_ts(date_minus_candles(timeframe, 1))
|
||||||
candles = self._exchange_ws.ccxt_object.ohlcvs.get(pair, {}).get(timeframe)
|
candles = self._exchange_ws.ohlcvs.get(pair, {}).get(timeframe)
|
||||||
half_candle = int(candle_ts - (candle_ts - prev_candle_ts) * 0.5)
|
half_candle = int(candle_ts - (candle_ts - prev_candle_ts) * 0.5)
|
||||||
last_refresh_time = int(
|
last_refresh_time = int(
|
||||||
self._exchange_ws.klines_last_refresh.get((pair, timeframe, candle_type), 0)
|
self._exchange_ws.klines_last_refresh.get((pair, timeframe, candle_type), 0)
|
||||||
|
|||||||
@@ -83,6 +83,13 @@ class ExchangeWS:
|
|||||||
"""
|
"""
|
||||||
self.ccxt_object.ohlcvs.get(paircomb[0], {}).pop(paircomb[1], None)
|
self.ccxt_object.ohlcvs.get(paircomb[0], {}).pop(paircomb[1], None)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def ohlcvs(self) -> dict[str, dict[str, list[list]]]:
|
||||||
|
"""
|
||||||
|
Returns the ccxt cache for OHLCV data
|
||||||
|
"""
|
||||||
|
return self.ccxt_object.ohlcvs
|
||||||
|
|
||||||
def cleanup_expired(self) -> None:
|
def cleanup_expired(self) -> None:
|
||||||
"""
|
"""
|
||||||
Remove pairs from watchlist if they've not been requested within
|
Remove pairs from watchlist if they've not been requested within
|
||||||
|
|||||||
Reference in New Issue
Block a user