Ad check_sell_timeout

This commit is contained in:
Matthias 2020-02-21 20:27:13 +01:00
parent 8c1a933221
commit 6c01542fed
2 changed files with 23 additions and 1 deletions

View File

@ -830,7 +830,11 @@ class FreqtradeBot:
self.wallets.update()
elif ((order['side'] == 'sell' and order['status'] == 'canceled')
or (self._check_timed_out('sell', order))):
or (self._check_timed_out('sell', order))
or strategy_safe_wrapper(self.strategy.check_sell_timeout,
default_retval=False)(pair=trade.pair,
trade=trade,
order=order)):
self.handle_timedout_limit_sell(trade, order)
self.wallets.update()

View File

@ -167,6 +167,24 @@ class IStrategy(ABC):
"""
return False
def check_sell_timeout(self, pair: str, trade: Trade, order: Dict, **kwargs) -> bool:
"""
Check sell timeout function callback.
This method can be used to override the sell-timeout.
It is called whenever a limit sell 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 sell-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.