Correct get_min_pair_stake_amount formula
If I understand well, the goal is to have stoploss price above the minimum required by the exchange, which is not what has been achieved so far. Only if amount_reserve_percent = (1 + pad) / (1 - abs(stoploss)) we get final stake amount * (1 - abs(stoploss)) > minimum required. Here is a code example, with numbers from the example in the doc for this function: stoploss = 0.1 padding = 0.05 min_required_exchange_cost = 10 min_required_exchange_amount = 12 min_required_exchange = max(min_required_exchange_cost, min_required_exchange_amount) min_required_with_padding = min_required_exchange * (1 + padding) min_stake_amount = min_required_exchange * max(min(padding + stoploss + 1, 1.5), 1) stoploss_price = min_stake_amount*(1-stoploss) print(f'[OLD LOGIC] stoploss_price ({stoploss_price}) < min_required_with_padding ({min_required_with_padding})') min_stake_amount = min_required_exchange * max(min((1+padding) / (1-stoploss), 1.5), 1) stoploss_price = min_stake_amount*(1-stoploss) print(f'[NEW LOGIC] stoploss_price ({stoploss_price}) > min_required_with_padding ({min_required_with_padding})')
This commit is contained in:
parent
862df2b431
commit
1283f8cfd4
@ -539,7 +539,7 @@ class Exchange:
|
||||
# reserve some percent defined in config (5% default) + stoploss
|
||||
amount_reserve_percent = 1.0 + self._config.get('amount_reserve_percent',
|
||||
DEFAULT_AMOUNT_RESERVE_PERCENT)
|
||||
amount_reserve_percent += abs(stoploss)
|
||||
amount_reserve_percent /= 1 - abs(stoploss)
|
||||
# it should not be more than 50%
|
||||
amount_reserve_percent = max(min(amount_reserve_percent, 1.5), 1)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user