]> Piment Noir Git Repositories - freqai-strategies.git/commit
fix(quickadapter): avoid duplicate backtest exit reserve (#152)
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Wed, 29 Jul 2026 15:09:09 +0000 (17:09 +0200)
committerGitHub <noreply@github.com>
Wed, 29 Jul 2026 15:09:09 +0000 (17:09 +0200)
commit0d060f7c96935364c3692c38d6758a8104265de3
tree5332e21bc431bae1cb9dea3154ef71e81f77a748
parentaa8fbc403b5efa66a465ba7e868cf705bb686f85
fix(quickadapter): avoid duplicate backtest exit reserve (#152)

The partial-exit minimum bound previously multiplied `min_stake` by the
stoploss/rate factor `max(current_exit_rate/current_entry_rate,
1/(1-|stoploss|))` in every runmode. In backtest/hyperopt, Freqtrade already
passes the adjusted minimum it guards the remainder against, so that factor
duplicated the stoploss reserve. Apply the factor only in live/dry-run
(is_trade_runmode == TRADE_MODES = {LIVE, DRY_RUN}), where the callback supplies
min_entry_stake (stoploss 0.0) but the guard uses the larger min_exit_stake;
keep the 0.1% numerical clearance in both modes. Live/dry-run behavior is
bit-for-bit unchanged. Freqtrade remains responsible for amount precision and
final pre-order minimum validation.

Also rename the local bound to `min_remaining_position_value` (it is the minimum
acceptable remaining position value, not an exit stake).

Fixes #138
quickadapter/user_data/strategies/QuickAdapterV3.py