diff --git a/octobot_evaluators/evaluator/abstract_evaluator.py b/octobot_evaluators/evaluator/abstract_evaluator.py index b0059520..1658e1db 100644 --- a/octobot_evaluators/evaluator/abstract_evaluator.py +++ b/octobot_evaluators/evaluator/abstract_evaluator.py @@ -157,7 +157,8 @@ async def evaluation_completed(self, time_frame=None, eval_note=None, eval_time=0, - notify=True) -> None: + notify=True, + origin_consumer=None) -> None: """ Main async method to notify matrix to update :param cryptocurrency: evaluated cryptocurrency @@ -166,6 +167,7 @@ async def evaluation_completed(self, :param eval_note: if None = self.eval_note :param eval_time: the time of the evaluation if relevant, default is 0 :param notify: if true, will trigger matrix consumers + :param origin_consumer: the sender consumer if it doesn't want to be notified :return: None """ try: @@ -184,7 +186,8 @@ async def evaluation_completed(self, cryptocurrency=cryptocurrency, symbol=symbol, time_frame=time_frame, - notify=notify) + notify=notify, + origin_consumer=origin_consumer) except Exception as e: # if ConfigManager.is_in_dev_mode(self.config): # TODO # raise e diff --git a/octobot_evaluators/evaluator/strategy_evaluator.py b/octobot_evaluators/evaluator/strategy_evaluator.py index ec788183..72cac4a7 100644 --- a/octobot_evaluators/evaluator/strategy_evaluator.py +++ b/octobot_evaluators/evaluator/strategy_evaluator.py @@ -55,6 +55,29 @@ async def start(self, bot_id: str) -> bool: self.strategy_matrix_callback) return True + async def strategy_completed(self, + cryptocurrency: str = None, + symbol: str = None, + eval_note=None, + eval_time=0, + notify=True) -> None: + """ + Main async method to notify that a strategy has updated its evaluation + :param cryptocurrency: evaluated cryptocurrency + :param symbol: evaluated symbol + :param eval_note: if None = self.eval_note + :param eval_time: the time of the evaluation if relevant, default is 0 + :param notify: if true, will trigger matrix consumers + :return: None + """ + return await self.evaluation_completed(cryptocurrency=cryptocurrency, + symbol=symbol, + time_frame=None, + eval_note=eval_note, + eval_time=eval_time, + notify=notify, + origin_consumer=self.consumer_instance) + def is_technical_evaluator_cycle_complete(self, matrix_id, evaluator_name, evaluator_type, exchange_name, cryptocurrency, symbol, time_frame) -> bool: """ @@ -98,10 +121,6 @@ async def strategy_matrix_callback(self, cryptocurrency, symbol, time_frame): - # TODO: find better way than this if - # avoid self-calls - if evaluator_name == self.get_name(): - return # if this callback is from a technical evaluator: ensure strategy should be notified at this moment if evaluator_type == EvaluatorMatrixTypes.TA.value: # ensure this time frame is within the strategy's time frames