@@ -214,8 +214,8 @@ class AwesomeStrategy(IStrategy):
214
214
``` python hl_lines="4"
215
215
class AwesomeStrategy (IStrategy ):
216
216
def custom_stake_amount (self , pair : str , current_time : datetime, current_rate : float ,
217
- proposed_stake : float , min_stake : Optional[ float ] , max_stake : float ,
218
- entry_tag : Optional[ str ] , side : str , ** kwargs ) -> float :
217
+ proposed_stake : float , min_stake : float | None , max_stake : float ,
218
+ entry_tag : str | None , side : str , ** kwargs ) -> float :
219
219
# ...
220
220
return proposed_stake
221
221
```
@@ -237,7 +237,7 @@ After:
237
237
``` python hl_lines="4"
238
238
class AwesomeStrategy (IStrategy ):
239
239
def confirm_trade_entry (self , pair : str , order_type : str , amount : float , rate : float ,
240
- time_in_force : str , current_time : datetime, entry_tag : Optional[ str ] ,
240
+ time_in_force : str , current_time : datetime, entry_tag : str | None ,
241
241
side : str , ** kwargs ) -> bool :
242
242
return True
243
243
```
@@ -280,8 +280,8 @@ After:
280
280
281
281
``` python hl_lines="3"
282
282
class AwesomeStrategy (IStrategy ):
283
- def custom_entry_price (self , pair : str , trade : Optional[ Trade] , current_time : datetime, proposed_rate : float ,
284
- entry_tag : Optional[ str ] , side : str , ** kwargs ) -> float :
283
+ def custom_entry_price (self , pair : str , trade : Trade | None , current_time : datetime, proposed_rate : float ,
284
+ entry_tag : str | None , side : str , ** kwargs ) -> float :
285
285
return proposed_rate
286
286
```
287
287
@@ -312,7 +312,7 @@ After:
312
312
``` python hl_lines="5 7"
313
313
def custom_stoploss (self , pair : str , trade : ' Trade' , current_time : datetime,
314
314
current_rate : float , current_profit : float , after_fill : bool ,
315
- ** kwargs ) -> Optional[ float ] :
315
+ ** kwargs ) -> float | None :
316
316
# once the profit has risen above 10%, keep the stoploss at 7% above the open price
317
317
if current_profit > 0.10 :
318
318
return stoploss_from_open(0.07 , current_profit, is_short = trade.is_short)
0 commit comments