예제 #1
0
 async def _create_evaluators(self):
     for exchange_id in self.exchange_manager_ids:
         exchange_configuration = trading_api.get_exchange_configuration_from_exchange_id(exchange_id)
         self.evaluators = await evaluator_api.create_all_type_evaluators(
             self.tentacles_setup_config,
             matrix_id=self.matrix_id,
             exchange_name=exchange_configuration.exchange_name,
             bot_id=self.bot_id,
             symbols_by_crypto_currencies=exchange_configuration.symbols_by_crypto_currencies,
             symbols=exchange_configuration.symbols,
             time_frames=exchange_configuration.time_frames_without_real_time,
             real_time_time_frames=exchange_configuration.real_time_time_frames)
예제 #2
0
 async def octobot_channel_callback(self, bot_id, subject, action,
                                    data) -> None:
     """
     OctoBot channel consumer callback
     :param bot_id: the callback bot id
     :param subject: the callback subject
     :param action: the callback action
     :param data: the callback data
     """
     if subject == enums.OctoBotChannelSubjects.NOTIFICATION.value:
         if action == trading_channel_consumer.OctoBotChannelTradingActions.EXCHANGE.value:
             if trading_channel_consumer.OctoBotChannelTradingDataKeys.EXCHANGE_ID.value in data:
                 exchange_id = data[
                     trading_channel_consumer.OctoBotChannelTradingDataKeys.
                     EXCHANGE_ID.value]
                 self.octobot.exchange_producer.exchange_manager_ids.append(
                     exchange_id)
                 await logger.init_exchange_chan_logger(exchange_id)
                 exchange_configuration = trading_api.get_exchange_configuration_from_exchange_id(
                     exchange_id)
                 await self.octobot.evaluator_producer.create_evaluators(
                     exchange_configuration)
                 # If an exchange is created before interface producer is done, it will be registered via
                 # self.octobot.interface_producer directly on creation
                 await self.octobot.interface_producer.register_exchange(
                     exchange_id)
         elif action == evaluator_channel_consumer.OctoBotChannelEvaluatorActions.EVALUATOR.value:
             if not self.octobot.service_feed_producer.started:
                 # Start service feeds now that evaluators registered their feed requirements
                 await self.octobot.service_feed_producer.start_feeds()
         elif action == service_channel_consumer.OctoBotChannelServiceActions.INTERFACE.value:
             await self.octobot.interface_producer.register_interface(
                 data[service_channel_consumer.
                      OctoBotChannelServiceDataKeys.INSTANCE.value])
         elif action == service_channel_consumer.OctoBotChannelServiceActions.NOTIFICATION.value:
             await self.octobot.interface_producer.register_notifier(
                 data[service_channel_consumer.
                      OctoBotChannelServiceDataKeys.INSTANCE.value])
         elif action == service_channel_consumer.OctoBotChannelServiceActions.SERVICE_FEED.value:
             await self.octobot.service_feed_producer.register_service_feed(
                 data[service_channel_consumer.
                      OctoBotChannelServiceDataKeys.INSTANCE.value])