def __init__(self, config, strategy_name): self.is_properly_initialized = False self.logger = get_logger(self.get_name()) AdvancedManager.init_advanced_classes_if_necessary(config) self.trading_mode = get_activated_trading_mode(config) self.config = create_blank_config_using_loaded_one(config) self.strategy_class = get_class_from_string( strategy_name, StrategiesEvaluator, Strategies, evaluator_parent_inspection) self.run_results = [] self.results_report = [] self.sorted_results_by_time_frame = {} self.sorted_results_through_all_time_frame = {} self.all_time_frames = [] self.all_TAs = [] self.risks = [] self.current_test_suite = None self.errors = set() self.is_computing = False self.run_id = 0 self.total_nb_runs = 0 if not self.strategy_class: self.logger.error( f"Impossible to find a strategy matching class name: {strategy_name} in installed " f"strategies. Please make sure to enter the name of the class, " f"ex: FullMixedStrategiesEvaluator") else: self.is_properly_initialized = True
def __init__(self, config): self.start_time = time.time() self.config = config self.startup_config = copy.deepcopy(config) self.edited_config = copy.deepcopy(config) self.ready = False self.watcher = None # tools: used for alternative operations on a bot on the fly (ex: backtesting started from web interface) self.tools = { BOT_TOOLS_BACKTESTING: None, BOT_TOOLS_STRATEGY_OPTIMIZER: None, BOT_TOOLS_RECORDER: None, } # Logger self.logger = get_logger(self.__class__.__name__) # Advanced AdvancedManager.init_advanced_classes_if_necessary(self.config) # Debug tools self.performance_analyser = None if CONFIG_DEBUG_OPTION_PERF in self.config and self.config[ CONFIG_DEBUG_OPTION_PERF]: self.performance_analyser = PerformanceAnalyser() # Init time frames using enabled strategies EvaluatorCreator.init_time_frames_from_strategies(self.config) self.time_frames = TimeFrameManager.get_config_time_frame(self.config) # Init relevant evaluator names list using enabled strategies self.relevant_evaluators = EvaluatorCreator.get_relevant_evaluators_from_strategies( self.config) # Backtesting self.backtesting_enabled = Backtesting.enabled(self.config) # Add services to self.config[CONFIG_CATEGORY_SERVICES] ServiceCreator.create_services(self.config, self.backtesting_enabled) # Notifier self.config[CONFIG_NOTIFICATION_INSTANCE] = Notification(self.config) # Notify starting if self.config[CONFIG_NOTIFICATION_INSTANCE].enabled( CONFIG_NOTIFICATION_GLOBAL_INFO): self.config[CONFIG_NOTIFICATION_INSTANCE].notify_with_all( NOTIFICATION_STARTING_MESSAGE, False) self.symbol_threads_manager = {} self.exchange_traders = {} self.exchange_trader_simulators = {} self.trading_mode = None self.exchange_trading_modes = {} self.exchanges_list = {} self.symbol_evaluator_list = {} self.crypto_currency_evaluator_list = {} self.dispatchers_list = [] self.symbol_time_frame_updater_threads = []
def __init__(self, config): self.start_time = time.time() self.config = config self.startup_config = copy.deepcopy(config) self.edited_config = copy.deepcopy(config) self.ready = False self.watcher = None self.current_loop_thread = None # tools: used for alternative operations on a bot on the fly (ex: backtesting started from web interface) self.tools = { BOT_TOOLS_BACKTESTING: None, BOT_TOOLS_STRATEGY_OPTIMIZER: None, BOT_TOOLS_RECORDER: None, } # Logger self.logger = get_logger(self.__class__.__name__) # Advanced AdvancedManager.init_advanced_classes_if_necessary(self.config) # Debug tools self.performance_analyser = None if CONFIG_DEBUG_OPTION_PERF in self.config and self.config[ CONFIG_DEBUG_OPTION_PERF]: self.performance_analyser = PerformanceAnalyser() # Init time frames using enabled strategies EvaluatorCreator.init_time_frames_from_strategies(self.config) self.time_frames = TimeFrameManager.get_config_time_frame(self.config) # Init relevant evaluator names list using enabled strategies self.relevant_evaluators = EvaluatorCreator.get_relevant_evaluators_from_strategies( self.config) # Backtesting self.backtesting_enabled = Backtesting.enabled(self.config) # Notifier self.config[CONFIG_NOTIFICATION_INSTANCE] = Notification(self.config) self.symbol_tasks_manager = {} self.exchange_traders = {} self.exchange_trader_simulators = {} self.trading_mode = None self.exchange_trading_modes = {} self.exchanges_list = {} self.symbol_evaluator_list = {} self.crypto_currency_evaluator_list = {} self.dispatchers_list = [] self.global_updaters_by_exchange = {} self.async_loop = None self.social_eval_tasks = [] self.real_time_eval_tasks = [] self.main_task_group = None