From 224213840d90994acfae181ee96dfcb9baec3683 Mon Sep 17 00:00:00 2001 From: Axel-CH Date: Sun, 17 Sep 2023 03:13:40 -0400 Subject: [PATCH] update trade object as optional parameter --- docs/strategy_migration.md | 4 ++-- freqtrade/freqtradebot.py | 2 +- freqtrade/strategy/interface.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/strategy_migration.md b/docs/strategy_migration.md index aaa655473..9e6f56e49 100644 --- a/docs/strategy_migration.md +++ b/docs/strategy_migration.md @@ -271,7 +271,7 @@ New string argument `side` - which can be either `"long"` or `"short"`. ``` python hl_lines="3" class AwesomeStrategy(IStrategy): - def custom_entry_price(self, pair: str, trade: 'Trade', current_time: datetime, proposed_rate: float, + def custom_entry_price(self, pair: str, current_time: datetime, proposed_rate: float, entry_tag: Optional[str], **kwargs) -> float: return proposed_rate ``` @@ -280,7 +280,7 @@ After: ``` python hl_lines="3" class AwesomeStrategy(IStrategy): - def custom_entry_price(self, pair: str, trade: 'Trade', current_time: datetime, proposed_rate: float, + def custom_entry_price(self, pair: str, trade: Optional[Trade], current_time: datetime, proposed_rate: float, entry_tag: Optional[str], side: str, **kwargs) -> float: return proposed_rate ``` diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 0d145db3b..1dd7884e0 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -938,7 +938,7 @@ class FreqtradeBot(LoggingMixin): custom_entry_price = strategy_safe_wrapper(self.strategy.custom_entry_price, default_retval=enter_limit_requested)( pair=pair, - trade=trade, # type: ignore[arg-type] + trade=trade, current_time=datetime.now(timezone.utc), proposed_rate=enter_limit_requested, entry_tag=entry_tag, side=trade_side, diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 0e0a29a45..1c9a18b5c 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -395,7 +395,7 @@ class IStrategy(ABC, HyperStrategyMixin): """ return self.stoploss - def custom_entry_price(self, pair: str, trade: Trade, + def custom_entry_price(self, pair: str, trade: Optional[Trade], current_time: datetime, proposed_rate: float, entry_tag: Optional[str], side: str, **kwargs) -> float: """