Simplify should_exit interface

This commit is contained in:
Matthias
2021-08-24 20:47:54 +02:00
parent f3b6a0a797
commit 6524edbb4e
3 changed files with 5 additions and 8 deletions

View File

@@ -333,10 +333,11 @@ class Backtesting:
def _get_sell_trade_entry(self, trade: LocalTrade, sell_row: Tuple) -> Optional[LocalTrade]:
sell_candle_time = sell_row[DATE_IDX].to_pydatetime()
enter = sell_row[LONG_IDX] if trade.is_short else sell_row[SHORT_IDX]
exit_ = sell_row[ELONG_IDX] if trade.is_short else sell_row[ESHORT_IDX]
sell = self.strategy.should_exit(
trade, sell_row[OPEN_IDX], sell_candle_time, # type: ignore
enter_long=sell_row[LONG_IDX], enter_short=sell_row[SHORT_IDX],
exit_long=sell_row[ELONG_IDX], exit_short=sell_row[ESHORT_IDX],
enter=enter, exit_=exit_,
low=sell_row[LOW_IDX], high=sell_row[HIGH_IDX]
)