Update documentation with backtesting compounding possibilities

This commit is contained in:
Matthias 2021-02-26 19:53:29 +01:00
parent 98f3142b30
commit f5bb5f56f1
5 changed files with 18 additions and 14 deletions

View File

@ -49,7 +49,7 @@ optional arguments:
Enable protections for backtesting.Will slow Enable protections for backtesting.Will slow
backtesting down by a considerable amount, but will backtesting down by a considerable amount, but will
include configured protections include configured protections
--dry-run-wallet DRY_RUN_WALLET --dry-run-wallet DRY_RUN_WALLET, --starting-balance DRY_RUN_WALLET
Starting balance, used for backtesting / hyperopt and Starting balance, used for backtesting / hyperopt and
dry-runs. dry-runs.
--strategy-list STRATEGY_LIST [STRATEGY_LIST ...] --strategy-list STRATEGY_LIST [STRATEGY_LIST ...]
@ -108,10 +108,19 @@ All profit calculations include fees, and freqtrade will use the exchange's defa
!!! Warning "Using dynamic pairlists for backtesting" !!! Warning "Using dynamic pairlists for backtesting"
Using dynamic pairlists is possible, however it relies on the current market conditions - which will not reflect the historic status of the pairlist. Using dynamic pairlists is possible, however it relies on the current market conditions - which will not reflect the historic status of the pairlist.
Also, when using pairlists other than StaticPairlist, reproducability of backtesting-results cannot be guaranteed. Also, when using pairlists other than StaticPairlist, reproducability of backtesting-results cannot be guaranteed.
Please read the [pairlists documentation](plugins.md#pairlists) for more information. Please read the [pairlists documentation](plugins.md#pairlists) for more information.
To achieve reproducible results, best generate a pairlist via the [`test-pairlist`](utils.md#test-pairlist) command and use that as static pairlist. To achieve reproducible results, best generate a pairlist via the [`test-pairlist`](utils.md#test-pairlist) command and use that as static pairlist.
### Starting balance
Backtesting will require a starting balance, which can be given as `--dry-run-wallet <balance>` or `--starting-balance <balance>` command line argument, or via `dry_run_wallet` configuration setting.
This amount must be higher than `stake_amount`, otherwise the bot will not be able to simulate any trade.
### Dynamic stake amount
Backtesting supports [dynamic stake amount](configuration.md#dynamic-stake-amount) by configuring `stake_amount` as `"unlimited"`, which will split the starting balance into `max_open_trades` pieces.
Profits from early trades will result in subsequent higher stake amounts, resulting in compounding of profits over the backtesting period.
### Example backtesting commands ### Example backtesting commands
With 5 min candle (OHLCV) data (per default) With 5 min candle (OHLCV) data (per default)

View File

@ -67,7 +67,7 @@ optional arguments:
--sd-notify Notify systemd service manager. --sd-notify Notify systemd service manager.
--dry-run Enforce dry-run for trading (removes Exchange secrets --dry-run Enforce dry-run for trading (removes Exchange secrets
and simulates trades). and simulates trades).
--dry-run-wallet DRY_RUN_WALLET --dry-run-wallet DRY_RUN_WALLET, --starting-balance DRY_RUN_WALLET
Starting balance, used for backtesting / hyperopt and Starting balance, used for backtesting / hyperopt and
dry-runs. dry-runs.

View File

@ -218,11 +218,12 @@ To allow the bot to trade all the available `stake_currency` in your account (mi
"tradable_balance_ratio": 0.99, "tradable_balance_ratio": 0.99,
``` ```
!!! Note !!! Tip "Compounding profits"
This configuration will allow increasing / decreasing stakes depending on the performance of the bot (lower stake if bot is loosing, higher stakes if the bot has a winning record, since higher balances are available). This configuration will allow increasing / decreasing stakes depending on the performance of the bot (lower stake if bot is loosing, higher stakes if the bot has a winning record, since higher balances are available), and will result in profit compounding.
!!! Note "When using Dry-Run Mode" !!! Note "When using Dry-Run Mode"
When using `"stake_amount" : "unlimited",` in combination with Dry-Run, the balance will be simulated starting with a stake of `dry_run_wallet` which will evolve over time. It is therefore important to set `dry_run_wallet` to a sensible value (like 0.05 or 0.01 for BTC and 1000 or 100 for USDT, for example), otherwise it may simulate trades with 100 BTC (or more) or 0.05 USDT (or less) at once - which may not correspond to your real available balance or is less than the exchange minimal limit for the order amount for the stake currency. When using `"stake_amount" : "unlimited",` in combination with Dry-Run, Backtesting or Hyperopt, the balance will be simulated starting with a stake of `dry_run_wallet` which will evolve over time.
It is therefore important to set `dry_run_wallet` to a sensible value (like 0.05 or 0.01 for BTC and 1000 or 100 for USDT, for example), otherwise it may simulate trades with 100 BTC (or more) or 0.05 USDT (or less) at once - which may not correspond to your real available balance or is less than the exchange minimal limit for the order amount for the stake currency.
--8<-- "includes/pricing.md" --8<-- "includes/pricing.md"

View File

@ -83,7 +83,7 @@ optional arguments:
Enable protections for backtesting.Will slow Enable protections for backtesting.Will slow
backtesting down by a considerable amount, but will backtesting down by a considerable amount, but will
include configured protections include configured protections
--dry-run-wallet DRY_RUN_WALLET --dry-run-wallet DRY_RUN_WALLET, --starting-balance DRY_RUN_WALLET
Starting balance, used for backtesting / hyperopt and Starting balance, used for backtesting / hyperopt and
dry-runs. dry-runs.
-e INT, --epochs INT Specify number of epochs (default: 100). -e INT, --epochs INT Specify number of epochs (default: 100).

View File

@ -30,12 +30,6 @@ def setup_optimize_configuration(args: Dict[str, Any], method: RunMode) -> Dict[
stake = round_coin_value(config['stake_amount'], config['stake_currency']) stake = round_coin_value(config['stake_amount'], config['stake_currency'])
raise OperationalException(f"Starting balance ({wallet}) " raise OperationalException(f"Starting balance ({wallet}) "
f"is smaller than stake_amount {stake}.") f"is smaller than stake_amount {stake}.")
pass
# config['dry_run_wallet'] = config['stake_amount'] * \
# config['max_open_trades'] * (2 - config['tradable_balance_ratio'])
# logger.warning(f"Changing dry-run-wallet to {config['dry_run_wallet']} "
# "(max_open_trades * stake_amount).")
return config return config