Position-size should NEVER be over available_capital

Part of #4353
This commit is contained in:
Matthias
2021-02-11 17:09:31 +01:00
parent 3110d2dbb1
commit aa79574c0c
2 changed files with 28 additions and 14 deletions

View File

@@ -159,7 +159,8 @@ class Edge:
available_capital = (total_capital + capital_in_trade) * self._capital_ratio
allowed_capital_at_risk = available_capital * self._allowed_risk
max_position_size = abs(allowed_capital_at_risk / stoploss)
position_size = min(max_position_size, free_capital)
# Position size must be below available capital.
position_size = min(min(max_position_size, free_capital), available_capital)
if pair in self._cached_pairs:
logger.info(
'winrate: %s, expectancy: %s, position size: %s, pair: %s,'