POC for check_buy_timeout

This commit is contained in:
Matthias
2020-02-06 20:30:17 +01:00
parent 2816b96650
commit 49dcc561b7
3 changed files with 25 additions and 2 deletions

View File

@@ -149,6 +149,24 @@ class IStrategy(ABC):
:return: DataFrame with sell column
"""
def check_buy_timeout(self, pair: str, trade: Trade, order: Dict, **kwargs) -> bool:
"""
Check buy timeout function callback.
This method can be used to override the buy-timeout.
It is called whenever a limit buy order has been created,
and is not yet fully filled.
Configuration options in `unfilledtimeout` will be verified before this,
so ensure to set these timeouts high enough.
When not implemented by a strategy, this simply returns False.
:param pair: Pair the trade is for
:param trade: trade object.
:param order: Order dictionary as returned from CCXT.
:param **kwargs: Ensure to keep this here so updates to this won't break your strategy.
:return bool: When True is returned, then the buy-order is cancelled.
"""
return False
def informative_pairs(self) -> List[Tuple[str, str]]:
"""
Define additional, informative pair/interval combinations to be cached from the exchange.

View File

@@ -5,7 +5,7 @@ from freqtrade.exceptions import StrategyError
logger = logging.getLogger(__name__)
def strategy_safe_wrapper(f, message: str, default_retval=None):
def strategy_safe_wrapper(f, message: str = "", default_retval=None):
def wrapper(*args, **kwargs):
try:
return f(*args, **kwargs)