mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
Fix LocalTrade compatibility correctly
This commit is contained in:
@@ -561,7 +561,11 @@ class Backtesting:
|
||||
is_short = trade.is_short or False
|
||||
leverage = trade.leverage or 1.0
|
||||
side_1 = -1 if is_short else 1
|
||||
roi_entry, roi = self.strategy.min_roi_reached_entry(trade, trade_dur, current_time)
|
||||
roi_entry, roi = self.strategy.min_roi_reached_entry(
|
||||
trade, # type: ignore[arg-type]
|
||||
trade_dur,
|
||||
current_time,
|
||||
)
|
||||
if roi is not None and roi_entry is not None:
|
||||
if roi == -1 and roi_entry % self.timeframe_min == 0:
|
||||
# When force_exiting with ROI=-1, the roi time will always be equal to trade_dur.
|
||||
|
||||
@@ -28,7 +28,7 @@ from freqtrade.enums import (
|
||||
from freqtrade.exceptions import OperationalException, StrategyError
|
||||
from freqtrade.exchange import timeframe_to_minutes, timeframe_to_next_date, timeframe_to_seconds
|
||||
from freqtrade.misc import remove_entry_exit_signals
|
||||
from freqtrade.persistence import LocalTrade, Order, PairLocks, Trade
|
||||
from freqtrade.persistence import Order, PairLocks, Trade
|
||||
from freqtrade.strategy.hyper import HyperStrategyMixin
|
||||
from freqtrade.strategy.informative_decorator import (
|
||||
InformativeData,
|
||||
@@ -468,7 +468,7 @@ class IStrategy(ABC, HyperStrategyMixin):
|
||||
def custom_roi(
|
||||
self,
|
||||
pair: str,
|
||||
trade: Trade | LocalTrade,
|
||||
trade: Trade,
|
||||
current_time: datetime,
|
||||
entry_tag: str | None,
|
||||
side: str,
|
||||
@@ -1648,7 +1648,7 @@ class IStrategy(ABC, HyperStrategyMixin):
|
||||
|
||||
def min_roi_reached_entry(
|
||||
self,
|
||||
trade: Trade | LocalTrade,
|
||||
trade: Trade,
|
||||
trade_dur: int,
|
||||
current_time: datetime,
|
||||
) -> tuple[int | None, float | None]:
|
||||
|
||||
Reference in New Issue
Block a user