コード例 #1
0
    def load_config(self) -> None:
        # try with this class name
        self.trading_config = get_tentacle_config(self.__class__)

        # set default config if nothing found
        if not self.trading_config:
            self.set_default_config()
コード例 #2
0
    def get_default_strategies(cls, trading_mode_config=None):
        config = trading_mode_config or get_tentacle_config(cls)
        if TENTACLE_DEFAULT_CONFIG in config:
            return config[TENTACLE_DEFAULT_CONFIG]

        strategies_classes, _ = cls.get_required_strategies_names_and_count(config)
        return strategies_classes
コード例 #3
0
 def __init__(self):
     super().__init__()
     self.allowed_evaluator_types = [
         evaluators_enums.EvaluatorMatrixTypes.TA.value,
         evaluators_enums.EvaluatorMatrixTypes.REAL_TIME.value
     ]
     config = tentacles_manager_api.get_tentacle_config(self.__class__)
     self.weight_by_time_frames = TechnicalAnalysisStrategyEvaluator._get_weight_by_time_frames(
         config[TechnicalAnalysisStrategyEvaluator.TIME_FRAMES_TO_WEIGHT])
コード例 #4
0
 def get_required_strategies_names_and_count(cls, trading_mode_config=None):
     config = trading_mode_config or get_tentacle_config(cls)
     if TRADING_MODE_REQUIRED_STRATEGIES in config:
         return config[
             TRADING_MODE_REQUIRED_STRATEGIES], cls.get_required_strategies_count(
                 config)
     raise Exception(
         f"'{TRADING_MODE_REQUIRED_STRATEGIES}' is missing in configuration file"
     )
コード例 #5
0
 def __init__(self):
     super().__init__()
     self.re_evaluation_triggering_eval_types = [
         evaluators_enums.EvaluatorMatrixTypes.SOCIAL.value,
         evaluators_enums.EvaluatorMatrixTypes.REAL_TIME.value
     ]
     config = tentacles_manager_api.get_tentacle_config(self.__class__)
     self.social_evaluators_default_timeout = config.get(
         SimpleStrategyEvaluator.SOCIAL_EVALUATORS_NOTIFICATION_TIMEOUT_KEY,
         1 * commons_constants.HOURS_TO_SECONDS)
     self.re_evaluate_TA_when_social_or_realtime_notification = config.get(
         SimpleStrategyEvaluator.RE_EVAL_TA_ON_RT_OR_SOCIAL, True)
     self.background_social_evaluators = config.get(
         SimpleStrategyEvaluator.BACKGROUND_SOCIAL_EVALUATORS, [])
コード例 #6
0
 def get_required_time_frames(cls, config: dict):
     if evaluators_constants.CONFIG_FORCED_TIME_FRAME in config:
         return time_frame_manager.parse_time_frames(
             config[evaluators_constants.CONFIG_FORCED_TIME_FRAME])
     strategy_config = tentacles_manager_api.get_tentacle_config(cls)
     if TechnicalAnalysisStrategyEvaluator.TIME_FRAMES_TO_WEIGHT in strategy_config:
         tf_to_weight = strategy_config[
             TechnicalAnalysisStrategyEvaluator.TIME_FRAMES_TO_WEIGHT]
         return time_frame_manager.parse_time_frames(
             list(
                 TechnicalAnalysisStrategyEvaluator.
                 _get_weight_by_time_frames(tf_to_weight)))
     else:
         raise Exception(
             f"'{TechnicalAnalysisStrategyEvaluator.TIME_FRAMES_TO_WEIGHT}' "
             f"is missing in configuration file")
コード例 #7
0
 def __init__(self, tentacles_setup_config):
     super().__init__(tentacles_setup_config)
     self.tentacle_config = tentacles_manager_api.get_tentacle_config(
         self.tentacles_setup_config, self.__class__)
     self.channels_config = self.tentacle_config.get(
         self.CONFIG_CHANNELS_KEY, {})
コード例 #8
0
 def __init__(self, tentacles_setup_config):
     super().__init__(tentacles_setup_config)
     self.tentacle_config = tentacles_manager_api.get_tentacle_config(
         self.tentacles_setup_config, self.__class__)
     self.channels_config = self.tentacle_config.get(
         services_constants.CONFIG_TELEGRAM_CHANNEL, {})