Simplify should_exit interface
This commit is contained in:
@@ -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]
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user