From d9f838a65f23f39ea3d4b8c6ffc34d8d5e478422 Mon Sep 17 00:00:00 2001 From: eSeR1805 Date: Mon, 18 Apr 2022 21:20:50 +0300 Subject: [PATCH] Update template usage to reflect changes. --- .../subtemplates/strategy_methods_advanced.j2 | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/freqtrade/templates/subtemplates/strategy_methods_advanced.j2 b/freqtrade/templates/subtemplates/strategy_methods_advanced.j2 index 90dbade91..db64b3e07 100644 --- a/freqtrade/templates/subtemplates/strategy_methods_advanced.j2 +++ b/freqtrade/templates/subtemplates/strategy_methods_advanced.j2 @@ -30,26 +30,31 @@ def custom_entry_price(self, pair: str, current_time: 'datetime', proposed_rate: """ return proposed_rate -def readjust_entry_price(self, trade: Trade, pair: str, current_time: datetime, - proposed_rate: float, entry_tag: Optional[str], - side: str, **kwargs) -> float: - """ - Entry price readjustment logic, returning the readjusted entry price. + def adjust_entry_price(self, trade: Trade, order: Order, pair: str, + current_time: datetime, proposed_rate: float, + entry_tag: Optional[str], side: str, **kwargs) -> float: + """ + 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) + and not timed out on subsequent candles after entry trigger. - For full documentation please go to https://www.freqtrade.io/en/latest/strategy-callbacks/ + For full documentation please go to https://www.freqtrade.io/en/latest/strategy-callbacks/ - When not implemented by a strategy, returns proposed_rate and orders are not replaced. + When not implemented by a strategy, returns proposed_stake. + If None is returned then order gets canceled but not replaced by a new one. - :param pair: Pair that's currently analyzed - :param trade: Trade object. - :param current_time: datetime object, containing the current datetime - :param proposed_rate: Rate, calculated based on pricing settings in entry_pricing. - :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 proposed_rate + :param pair: Pair that's currently analyzed + :param trade: Trade object. + :param order: Order object + :param current_time: datetime object, containing the current datetime + :param proposed_rate: Rate, calculated based on pricing settings in entry_pricing. + :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 proposed_rate def custom_exit_price(self, pair: str, trade: 'Trade', current_time: 'datetime', proposed_rate: float,