update trade object as optional parameter

This commit is contained in:
Axel-CH
2023-09-17 03:13:40 -04:00
parent d81fdeb3ed
commit 224213840d
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -271,7 +271,7 @@ New string argument `side` - which can be either `"long"` or `"short"`.
``` python hl_lines="3" ``` python hl_lines="3"
class AwesomeStrategy(IStrategy): 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: entry_tag: Optional[str], **kwargs) -> float:
return proposed_rate return proposed_rate
``` ```
@@ -280,7 +280,7 @@ After:
``` python hl_lines="3" ``` python hl_lines="3"
class AwesomeStrategy(IStrategy): 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: entry_tag: Optional[str], side: str, **kwargs) -> float:
return proposed_rate return proposed_rate
``` ```
+1 -1
View File
@@ -938,7 +938,7 @@ class FreqtradeBot(LoggingMixin):
custom_entry_price = strategy_safe_wrapper(self.strategy.custom_entry_price, custom_entry_price = strategy_safe_wrapper(self.strategy.custom_entry_price,
default_retval=enter_limit_requested)( default_retval=enter_limit_requested)(
pair=pair, pair=pair,
trade=trade, # type: ignore[arg-type] trade=trade,
current_time=datetime.now(timezone.utc), current_time=datetime.now(timezone.utc),
proposed_rate=enter_limit_requested, entry_tag=entry_tag, proposed_rate=enter_limit_requested, entry_tag=entry_tag,
side=trade_side, side=trade_side,
+1 -1
View File
@@ -395,7 +395,7 @@ class IStrategy(ABC, HyperStrategyMixin):
""" """
return self.stoploss 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, current_time: datetime, proposed_rate: float,
entry_tag: Optional[str], side: str, **kwargs) -> float: entry_tag: Optional[str], side: str, **kwargs) -> float:
""" """