From 7735ea91bb9cb117c719e13bab40cb154da63e6a Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 20 Mar 2025 20:32:34 +0100 Subject: [PATCH] fix: adjust_order_price return type --- docs/strategy-callbacks.md | 4 ++-- freqtrade/strategy/interface.py | 12 ++++++------ .../strategy_methods_advanced.j2 | 5 ++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/docs/strategy-callbacks.md b/docs/strategy-callbacks.md index 8286ee9bf..fb8b8070d 100644 --- a/docs/strategy-callbacks.md +++ b/docs/strategy-callbacks.md @@ -976,7 +976,7 @@ class AwesomeStrategy(IStrategy): side: str, is_entry: bool, **kwargs, - ) -> float: + ) -> float | None: """ Exit and entry order price re-adjustment logic, returning the user desired limit price. This only executes when a order was already placed, still open (unfilled fully or partially) @@ -998,7 +998,7 @@ class AwesomeStrategy(IStrategy): :param side: 'long' or 'short' - indicating the direction of the proposed trade :param is_entry: True if the order is an entry order, False if it's an exit order. :param **kwargs: Ensure to keep this here so updates to this won't break your strategy. - :return float: New entry price value if provided + :return float or None: New entry price value if provided """ # Limit entry orders to use and follow SMA200 as price target for the first 10 minutes since entry trigger for BTC/USDT pair. diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 79ea094c9..98e02cdd6 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -664,7 +664,7 @@ class IStrategy(ABC, HyperStrategyMixin): entry_tag: str | None, side: str, **kwargs, - ) -> float: + ) -> float | None: """ Entry price re-adjustment logic, returning the user desired limit price. This only executes when a order was already placed, still open (unfilled fully or partially) @@ -685,7 +685,7 @@ class IStrategy(ABC, HyperStrategyMixin): :param entry_tag: Optional entry_tag (buy_tag) if provided with the buy signal. :param side: 'long' or 'short' - indicating the direction of the proposed trade :param **kwargs: Ensure to keep this here so updates to this won't break your strategy. - :return float: New entry price value if provided + :return float or None: New entry price value if provided """ return current_order_rate @@ -701,7 +701,7 @@ class IStrategy(ABC, HyperStrategyMixin): entry_tag: str | None, side: str, **kwargs, - ) -> float: + ) -> float | None: """ Exit price re-adjustment logic, returning the user desired limit price. This only executes when a order was already placed, still open (unfilled fully or partially) @@ -722,7 +722,7 @@ class IStrategy(ABC, HyperStrategyMixin): :param entry_tag: Optional entry_tag (buy_tag) if provided with the buy signal. :param side: 'long' or 'short' - indicating the direction of the proposed trade :param **kwargs: Ensure to keep this here so updates to this won't break your strategy. - :return float: New entry price value if provided + :return float or None: New exit price value if provided """ return current_order_rate @@ -739,7 +739,7 @@ class IStrategy(ABC, HyperStrategyMixin): side: str, is_entry: bool, **kwargs, - ) -> float: + ) -> float | None: """ Exit and entry order price re-adjustment logic, returning the user desired limit price. This only executes when a order was already placed, still open (unfilled fully or partially) @@ -761,7 +761,7 @@ class IStrategy(ABC, HyperStrategyMixin): :param side: 'long' or 'short' - indicating the direction of the proposed trade :param is_entry: True if the order is an entry order, False if it's an exit order. :param **kwargs: Ensure to keep this here so updates to this won't break your strategy. - :return float: New entry price value if provided + :return float or None: New entry price value if provided """ if is_entry: return self.adjust_entry_price( diff --git a/freqtrade/templates/strategy_subtemplates/strategy_methods_advanced.j2 b/freqtrade/templates/strategy_subtemplates/strategy_methods_advanced.j2 index 5ff483243..dc133c75a 100644 --- a/freqtrade/templates/strategy_subtemplates/strategy_methods_advanced.j2 +++ b/freqtrade/templates/strategy_subtemplates/strategy_methods_advanced.j2 @@ -52,7 +52,7 @@ def adjust_order_price( side: str, is_entry: bool, **kwargs, -) -> float: +) -> float | None: """ Exit and entry order price re-adjustment logic, returning the user desired limit price. This only executes when a order was already placed, still open (unfilled fully or partially) @@ -74,8 +74,7 @@ def adjust_order_price( :param side: 'long' or 'short' - indicating the direction of the proposed trade :param is_entry: True if the order is an entry order, False if it's an exit order. :param **kwargs: Ensure to keep this here so updates to this won't break your strategy. - :return float: New entry price value if provided - + :return float or None: New entry price value if provided """ return current_order_rate