Ejemplo n.º 1
0
    def _init_time_frames(self):
        # Init time frames using enabled strategies
        EvaluatorCreator.init_time_frames_from_strategies(self.octobot.get_config())
        self.time_frames = copy.copy(TimeFrameManager.get_config_time_frame(self.octobot.get_config()))

        # Init display time frame
        config_time_frames = TimeFrameManager.get_config_time_frame(self.octobot.get_config())
        if TimeFrames.ONE_HOUR not in config_time_frames and not backtesting_enabled(self.octobot.get_config()):
            config_time_frames.append(TimeFrames.ONE_HOUR)
            TimeFrameManager.sort_config_time_frames(self.octobot.get_config())
Ejemplo n.º 2
0
    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 = copy.copy(
            TimeFrameManager.get_config_time_frame(self.config))

        # Init display time frame
        config_time_frames = TimeFrameManager.get_config_time_frame(
            self.config)
        if TimeFrames.ONE_HOUR not in config_time_frames:
            config_time_frames.append(TimeFrames.ONE_HOUR)
            TimeFrameManager.sort_config_time_frames(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