Adding buy/sell events notifications to the strategy
This commit is contained in:
		| @@ -238,3 +238,17 @@ class DefaultStrategy(IStrategy): | ||||
|             ), | ||||
|             'sell'] = 1 | ||||
|         return dataframe | ||||
|  | ||||
|     def did_bought(self, pair: str): | ||||
|         """ | ||||
|         we are notified that a given pair was bought | ||||
|         :param pair: the pair that was is concerned by the dataframe | ||||
|         """ | ||||
|         assert False is not True | ||||
|  | ||||
|     def did_sold(self, pair: str): | ||||
|         """ | ||||
|         we are notified that a given pair was sold | ||||
|         :param pair: the pair that was is concerned by the dataframe | ||||
|         """ | ||||
|         assert False is not True | ||||
|   | ||||
| @@ -45,3 +45,17 @@ class IStrategy(ABC): | ||||
|         :param pair: the pair that was is concerned by the dataframe | ||||
|         :return: DataFrame with buy column | ||||
|         """ | ||||
|  | ||||
|     @abstractmethod | ||||
|     def did_bought(self, pair: str): | ||||
|         """ | ||||
|         we are notified that a given pair was bought | ||||
|         :param pair: the pair that was is concerned by the dataframe | ||||
|         """ | ||||
|  | ||||
|     @abstractmethod | ||||
|     def did_sold(self, pair: str): | ||||
|         """ | ||||
|         we are notified that a given pair was sold | ||||
|         :param pair: the pair that was is concerned by the dataframe | ||||
|         """ | ||||
|   | ||||
| @@ -167,3 +167,17 @@ class Strategy(object): | ||||
|         :return: DataFrame with buy column | ||||
|         """ | ||||
|         return self.custom_strategy.populate_sell_trend(dataframe, pair) | ||||
|  | ||||
|     def did_bought(self, pair: str): | ||||
|         """ | ||||
|         we are notified that a given pair was bought | ||||
|         :param pair: the pair that was is concerned by the dataframe | ||||
|         """ | ||||
|         return self.custom_strategy.did_bought(pair) | ||||
|  | ||||
|     def did_sold(self, pair: str): | ||||
|         """ | ||||
|         we are notified that a given pair was sold | ||||
|         :param pair: the pair that was is concerned by the dataframe | ||||
|         """ | ||||
|         return self.custom_strategy.did_sold(pair) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user