def get_command_configuration(markdown=False): _, bold, code = pretty_printer.get_markers(markdown) message = f"{bold}My configuration:{bold}{interfaces.EOL}{interfaces.EOL}" message += f"{bold}Traders: {bold}{interfaces.EOL}" if interfaces.has_trader(): has_real_trader, has_simulated_trader = interfaces.has_real_and_or_simulated_traders( ) if has_real_trader: message += f"{code}- Real trader{code}{interfaces.EOL}" if has_simulated_trader: message += f"{code}- Simulated trader{code}{interfaces.EOL}" else: message += f"{code}- No activated trader{code}{interfaces.EOL}" message += f"{interfaces.EOL}{bold}Exchanges:{bold}{interfaces.EOL}" for exchange_name in trading_api.get_exchange_names(): message += f"{code}- {exchange_name.capitalize()}{code}{interfaces.EOL}" try: import octobot_evaluators.api as evaluators_api import octobot_evaluators.enums as evaluators_enums tentacle_setup_config = interfaces.get_bot_api( ).get_tentacles_setup_config() message += f"{interfaces.EOL}{bold}Evaluators:{bold}{interfaces.EOL}" evaluators = evaluators_api.get_evaluator_classes_from_type( evaluators_enums.EvaluatorMatrixTypes.TA.value, tentacle_setup_config) evaluators += evaluators_api.get_evaluator_classes_from_type( evaluators_enums.EvaluatorMatrixTypes.SOCIAL.value, tentacle_setup_config) evaluators += evaluators_api.get_evaluator_classes_from_type( evaluators_enums.EvaluatorMatrixTypes.REAL_TIME.value, tentacle_setup_config) for evaluator in evaluators: message += f"{code}- {evaluator.get_name()}{code}{interfaces.EOL}" message += f"{interfaces.EOL}{bold}Strategies:{bold}{interfaces.EOL}" for strategy in evaluators_api.get_evaluator_classes_from_type( evaluators_enums.EvaluatorMatrixTypes.STRATEGIES.value, tentacle_setup_config): message += f"{code}- {strategy.get_name()}{code}{interfaces.EOL}" except ImportError: message += f"{interfaces.EOL}{bold}Impossible to retrieve evaluation configuration: requires OctoBot-Evaluators " \ f"package installed{bold}{interfaces.EOL}" try: trading_mode = interfaces.get_bot_api().get_trading_mode() except IndexError: # no activated trader trading_mode = None if trading_mode: message += f"{interfaces.EOL}{bold}Trading mode:{bold}{interfaces.EOL}" message += f"{code}- {trading_mode.get_name()}{code}" return message
async def _create_interfaces(self, in_backtesting): # do not overwrite data in case of inner bots init (backtesting) if service_interfaces.get_bot_api() is None: service_api.initialize_global_project_data( self.octobot.octobot_api, constants.PROJECT_NAME, constants.LONG_VERSION) interface_factory = service_api.create_interface_factory( self.octobot.config) interface_list = interface_factory.get_available_interfaces() for interface_class in interface_list: await self._create_interface_if_relevant( interface_factory, interface_class, in_backtesting, self.octobot.get_edited_config(constants.CONFIG_KEY))
def get_matrix_list(): try: import octobot_evaluators.api as evaluators_api except ImportError: logging.get_logger("InterfaceUtil").error( "get_matrix_list requires OctoBot-Evaluators package installed") return {} evaluations = {} matrix = evaluators_api.get_matrix( interfaces.get_bot_api().get_matrix_id()) for exchange, exchange_node in evaluators_api.get_node_children_by_names( matrix).items(): evaluations[exchange] = {} for tentacle_type_node in evaluators_api.get_children_list( exchange_node).values(): _get_tentacles_values(evaluations, tentacle_type_node, exchange) return evaluations
def set_command_restart(): interfaces.get_bot_api().restart_bot()
def set_command_stop(): interfaces.get_bot_api().stop_bot()