Added min_stake, max_stake. Removed pair as its included in trade.

This commit is contained in:
Reigo Reinmets
2022-01-08 17:20:02 +02:00
parent 813a2cd23b
commit 0bca07a32a
7 changed files with 69 additions and 29 deletions

View File

@@ -384,9 +384,9 @@ class IStrategy(ABC, HyperStrategyMixin):
"""
return proposed_stake
def adjust_trade_position(self, pair: str, trade: Trade, current_time: datetime,
current_rate: float, current_profit: float, **kwargs
) -> Optional[float]:
def adjust_trade_position(self, trade: Trade, current_time: datetime,
current_rate: float, current_profit: float, min_stake: float,
max_stake: float, **kwargs) -> Optional[float]:
"""
Custom trade adjustment logic, returning the stake amount that a trade should be increased.
This means extra buy orders with additional fees.
@@ -395,11 +395,12 @@ class IStrategy(ABC, HyperStrategyMixin):
When not implemented by a strategy, returns None
:param pair: Pair that's currently analyzed
:param trade: trade object.
:param current_time: datetime object, containing the current datetime
:param current_rate: Current buy rate. Use `exchange.get_rate` if you need sell rate.
:param current_rate: Current buy rate.
:param current_profit: Current profit (as ratio), calculated based on current_rate.
:param min_stake: Minimal stake size allowed by exchange.
:param max_stake: Balance available for trading.
:param **kwargs: Ensure to keep this here so updates to this won't break your strategy.
:return float: Stake amount to adjust your trade
"""