|
|
|
|
@ -804,17 +804,18 @@ For markets / exchanges that don't support leverage, this method is ignored.
|
|
|
|
|
|
|
|
|
|
``` python
|
|
|
|
|
class AwesomeStrategy(IStrategy):
|
|
|
|
|
def leverage(self, pair: str, current_time: 'datetime', current_rate: float,
|
|
|
|
|
proposed_leverage: float, max_leverage: float, side: str,
|
|
|
|
|
def leverage(self, pair: str, current_time: datetime, current_rate: float,
|
|
|
|
|
proposed_leverage: float, max_leverage: float, entry_tag: Optional[str], side: str,
|
|
|
|
|
**kwargs) -> float:
|
|
|
|
|
"""
|
|
|
|
|
Customize leverage for each new trade.
|
|
|
|
|
Customize leverage for each new trade. This method is only called in futures mode.
|
|
|
|
|
|
|
|
|
|
:param pair: Pair that's currently analyzed
|
|
|
|
|
:param current_time: datetime object, containing the current datetime
|
|
|
|
|
:param current_rate: Rate, calculated based on pricing settings in exit_pricing.
|
|
|
|
|
:param proposed_leverage: A leverage proposed by the bot.
|
|
|
|
|
:param max_leverage: Max leverage allowed on this pair
|
|
|
|
|
: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
|
|
|
|
|
:return: A leverage amount, which is between 1.0 and max_leverage.
|
|
|
|
|
"""
|
|
|
|
|
|