async def create_backtesting_exchange_producers(self): for importer in self.exchange_importers: available_data_types = get_available_data_types(importer) at_least_one_updater = False for channel_type, updater in UNAUTHENTICATED_UPDATER_SIMULATOR_PRODUCERS.items(): if self._are_required_data_available(channel_type, available_data_types): await updater(get_trading_chan(updater.CHANNEL_NAME, self.exchange_manager.id), importer).run() at_least_one_updater = True if not at_least_one_updater: self.logger.error(f"No updater created for {importer.symbols} backtesting")
async def resume(self): if self.time_consumer is None and not self.channel.is_paused: if ExchangeDataTables.TICKER in get_available_data_types(self.exchange_data_importer): self.time_consumer = await get_chan(OctoBotBacktestingChannelsName.TIME_CHANNEL.value).new_consumer( self.handle_timestamp) else: # asyncio.shield to avoid auto-cancel (if error in other tasks that will exit main asyncio.gather) # resulting in failure to register as consumer await asyncio.shield(register_on_ohlcv_chan(self.channel.exchange_manager.id, self._ticker_from_ohlcv_callback))
async def resume(self): if not self.is_running: if self.time_consumer is None and not self.channel.is_paused: if ExchangeDataTables.TICKER in get_available_data_types(self.exchange_data_importer): self.time_consumer = await get_chan(OctoBotBacktestingChannelsName.TIME_CHANNEL.value).new_consumer( self.handle_timestamp) else: await get_exchange_chan(OHLCV_CHANNEL, self.channel.exchange_manager.id)\ .new_consumer(self._ticker_from_ohlcv_callback) self.last_timestamp_pushed_by_symbol = { symbol: 0 for symbol in self.channel.exchange_manager.exchange_config.traded_symbol_pairs } self.is_running = True
def get_real_available_data(self): available_data = set() for importer in self.exchange_importers: available_data = available_data.union( get_available_data_types(importer)) return available_data