Add short-exit logic to backtesting

This commit is contained in:
Matthias
2021-08-24 19:55:00 +02:00
parent eb71ee847c
commit b40f985b13
4 changed files with 42 additions and 22 deletions

View File

@@ -856,14 +856,14 @@ class FreqtradeBot(LoggingMixin):
"""
Check and execute sell
"""
should_sell = self.strategy.should_sell(
should_exit: SellCheckTuple = self.strategy.should_exit(
trade, sell_rate, datetime.now(timezone.utc), buy, sell,
force_stoploss=self.edge.stoploss(trade.pair) if self.edge else 0
)
if should_sell.sell_flag:
logger.info(f'Executing Sell for {trade.pair}. Reason: {should_sell.sell_type}')
self.execute_sell(trade, sell_rate, should_sell)
if should_exit.sell_flag:
logger.info(f'Executing Sell for {trade.pair}. Reason: {should_exit.sell_type}')
self.execute_sell(trade, sell_rate, should_exit)
return True
return False