stable/freqtrade/exchange
Théo Martin 1283f8cfd4
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})')
2021-04-15 00:33:05 +01:00
..
__init__.py Add kucoin exchange subclass 2021-04-13 12:28:07 +02:00
bibox.py Apply isort to freqtrade codebase 2020-09-28 19:40:46 +02:00
binance.py Rename dry_run_order to create_dry_run_order 2021-04-10 13:50:56 +02:00
bittrex.py Add kucoin exchange subclass 2021-04-13 12:28:07 +02:00
bybit.py Add bybit subclass 2020-12-20 19:59:46 +01:00
common.py Remove hardcoded list of non-working exchanges 2021-04-06 20:03:38 +02:00
exchange.py Correct get_min_pair_stake_amount formula 2021-04-15 00:33:05 +01:00
ftx.py Update ftx.py 2021-04-12 16:01:46 +02:00
kraken.py Rename dry_run_order to create_dry_run_order 2021-04-10 13:50:56 +02:00
kucoin.py Add kucoin exchange subclass 2021-04-13 12:28:07 +02:00