mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Better define what interface is external
This commit is contained in:
parent
8a00bf3188
commit
dadc96306f
|
@ -53,24 +53,24 @@ class ExchangeWS():
|
||||||
logger.info(f"Removing {p} from watchlist")
|
logger.info(f"Removing {p} from watchlist")
|
||||||
self._klines_watching.discard(p)
|
self._klines_watching.discard(p)
|
||||||
|
|
||||||
async def schedule_while_true(self) -> None:
|
async def _schedule_while_true(self) -> None:
|
||||||
|
|
||||||
for p in self._klines_watching:
|
for p in self._klines_watching:
|
||||||
if p not in self._klines_scheduled:
|
if p not in self._klines_scheduled:
|
||||||
self._klines_scheduled.add(p)
|
self._klines_scheduled.add(p)
|
||||||
pair, timeframe, candle_type = p
|
pair, timeframe, candle_type = p
|
||||||
task = asyncio.create_task(
|
task = asyncio.create_task(
|
||||||
self.continuously_async_watch_ohlcv(pair, timeframe, candle_type))
|
self._continuously_async_watch_ohlcv(pair, timeframe, candle_type))
|
||||||
self._background_tasks.add(task)
|
self._background_tasks.add(task)
|
||||||
task.add_done_callback(self.continuous_stopped)
|
task.add_done_callback(self._continuous_stopped)
|
||||||
|
|
||||||
def continuous_stopped(self, task: asyncio.Task):
|
def _continuous_stopped(self, task: asyncio.Task):
|
||||||
self._background_tasks.discard(task)
|
self._background_tasks.discard(task)
|
||||||
result = task.result()
|
result = task.result()
|
||||||
logger.info(f"Task finished {result}")
|
logger.info(f"Task finished {result}")
|
||||||
# self._pairs_scheduled.discard(pair, timeframe, candle_type)
|
# self._pairs_scheduled.discard(pair, timeframe, candle_type)
|
||||||
|
|
||||||
async def continuously_async_watch_ohlcv(
|
async def _continuously_async_watch_ohlcv(
|
||||||
self, pair: str, timeframe: str, candle_type: CandleType) -> None:
|
self, pair: str, timeframe: str, candle_type: CandleType) -> None:
|
||||||
try:
|
try:
|
||||||
while (pair, timeframe, candle_type) in self._klines_watching:
|
while (pair, timeframe, candle_type) in self._klines_watching:
|
||||||
|
@ -92,7 +92,7 @@ class ExchangeWS():
|
||||||
self._klines_watching.add((pair, timeframe, candle_type))
|
self._klines_watching.add((pair, timeframe, candle_type))
|
||||||
self.klines_last_request[(pair, timeframe, candle_type)] = time.time()
|
self.klines_last_request[(pair, timeframe, candle_type)] = time.time()
|
||||||
# asyncio.run_coroutine_threadsafe(self.schedule_schedule(), loop=self._loop)
|
# asyncio.run_coroutine_threadsafe(self.schedule_schedule(), loop=self._loop)
|
||||||
asyncio.run_coroutine_threadsafe(self.schedule_while_true(), loop=self._loop)
|
asyncio.run_coroutine_threadsafe(self._schedule_while_true(), loop=self._loop)
|
||||||
self.cleanup_expired()
|
self.cleanup_expired()
|
||||||
|
|
||||||
async def get_ohlcv(
|
async def get_ohlcv(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user