Adding cancel buy/sell events

This commit is contained in:
Jean-Baptiste LE STANG
2018-01-30 21:34:26 +01:00
parent eacb6b5a03
commit b27c8256f4
4 changed files with 44 additions and 2 deletions

View File

@@ -244,11 +244,21 @@ class DefaultStrategy(IStrategy):
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
def did_cancel_buy(self, pair: str):
"""
we are notified that a given pair was bought
:param pair: the pair that was is concerned by the dataframe
"""
def did_cancel_sell(self, pair: str):
"""
we are notified that a given pair was sold
:param pair: the pair that was is concerned by the dataframe
"""

View File

@@ -59,3 +59,17 @@ class IStrategy(ABC):
we are notified that a given pair was sold
:param pair: the pair that was is concerned by the dataframe
"""
@abstractmethod
def did_cancel_buy(self, pair: str):
"""
we are notified that a given buy for a pair was cancelled
:param pair: the pair that was is concerned by the dataframe
"""
@abstractmethod
def did_cancel_sell(self, pair: str):
"""
we are notified that a given sell for a pair was cancelled
:param pair: the pair that was is concerned by the dataframe
"""

View File

@@ -181,3 +181,17 @@ class Strategy(object):
:param pair: the pair that was is concerned by the dataframe
"""
return self.custom_strategy.did_sold(pair)
def did_cancel_buy(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_cancel_buy(pair)
def did_cancel_sell(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_cancel_sell(pair)