commit
caa3e1a7fa
@ -5,6 +5,89 @@ This page explains how to validate your strategy performance by using Backtestin
|
|||||||
Backtesting requires historic data to be available.
|
Backtesting requires historic data to be available.
|
||||||
To learn how to get data for the pairs and exchange you're interested in, head over to the [Data Downloading](data-download.md) section of the documentation.
|
To learn how to get data for the pairs and exchange you're interested in, head over to the [Data Downloading](data-download.md) section of the documentation.
|
||||||
|
|
||||||
|
## Backtesting command reference
|
||||||
|
|
||||||
|
```
|
||||||
|
usage: freqtrade backtesting [-h] [-v] [--logfile FILE] [-V] [-c PATH]
|
||||||
|
[-d PATH] [--userdir PATH] [-s NAME]
|
||||||
|
[--strategy-path PATH] [-i TIMEFRAME]
|
||||||
|
[--timerange TIMERANGE]
|
||||||
|
[--data-format-ohlcv {json,jsongz,hdf5}]
|
||||||
|
[--max-open-trades INT]
|
||||||
|
[--stake-amount STAKE_AMOUNT] [--fee FLOAT]
|
||||||
|
[--eps] [--dmmp] [--enable-protections]
|
||||||
|
[--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]]
|
||||||
|
[--export EXPORT] [--export-filename PATH]
|
||||||
|
|
||||||
|
optional arguments:
|
||||||
|
-h, --help show this help message and exit
|
||||||
|
-i TIMEFRAME, --timeframe TIMEFRAME, --ticker-interval TIMEFRAME
|
||||||
|
Specify ticker interval (`1m`, `5m`, `30m`, `1h`,
|
||||||
|
`1d`).
|
||||||
|
--timerange TIMERANGE
|
||||||
|
Specify what timerange of data to use.
|
||||||
|
--data-format-ohlcv {json,jsongz,hdf5}
|
||||||
|
Storage format for downloaded candle (OHLCV) data.
|
||||||
|
(default: `None`).
|
||||||
|
--max-open-trades INT
|
||||||
|
Override the value of the `max_open_trades`
|
||||||
|
configuration setting.
|
||||||
|
--stake-amount STAKE_AMOUNT
|
||||||
|
Override the value of the `stake_amount` configuration
|
||||||
|
setting.
|
||||||
|
--fee FLOAT Specify fee ratio. Will be applied twice (on trade
|
||||||
|
entry and exit).
|
||||||
|
--eps, --enable-position-stacking
|
||||||
|
Allow buying the same pair multiple times (position
|
||||||
|
stacking).
|
||||||
|
--dmmp, --disable-max-market-positions
|
||||||
|
Disable applying `max_open_trades` during backtest
|
||||||
|
(same as setting `max_open_trades` to a very high
|
||||||
|
number).
|
||||||
|
--enable-protections, --enableprotections
|
||||||
|
Enable protections for backtesting.Will slow
|
||||||
|
backtesting down by a considerable amount, but will
|
||||||
|
include configured protections
|
||||||
|
--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]
|
||||||
|
Provide a space-separated list of strategies to
|
||||||
|
backtest. Please note that ticker-interval needs to be
|
||||||
|
set either in config or via command line. When using
|
||||||
|
this together with `--export trades`, the strategy-
|
||||||
|
name is injected into the filename (so `backtest-
|
||||||
|
data.json` becomes `backtest-data-
|
||||||
|
DefaultStrategy.json`
|
||||||
|
--export EXPORT Export backtest results, argument are: trades.
|
||||||
|
Example: `--export=trades`
|
||||||
|
--export-filename PATH
|
||||||
|
Save backtest results to the file with this filename.
|
||||||
|
Requires `--export` to be set as well. Example:
|
||||||
|
`--export-filename=user_data/backtest_results/backtest
|
||||||
|
_today.json`
|
||||||
|
|
||||||
|
Common arguments:
|
||||||
|
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
||||||
|
--logfile FILE Log to the file specified. Special values are:
|
||||||
|
'syslog', 'journald'. See the documentation for more
|
||||||
|
details.
|
||||||
|
-V, --version show program's version number and exit
|
||||||
|
-c PATH, --config PATH
|
||||||
|
Specify configuration file (default:
|
||||||
|
`userdir/config.json` or `config.json` whichever
|
||||||
|
exists). Multiple --config options may be used. Can be
|
||||||
|
set to `-` to read config from stdin.
|
||||||
|
-d PATH, --datadir PATH
|
||||||
|
Path to directory with historical backtesting data.
|
||||||
|
--userdir PATH, --user-data-dir PATH
|
||||||
|
Path to userdata directory.
|
||||||
|
|
||||||
|
Strategy arguments:
|
||||||
|
-s NAME, --strategy NAME
|
||||||
|
Specify strategy class name which will be used by the
|
||||||
|
bot.
|
||||||
|
--strategy-path PATH Specify additional strategy lookup path.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
## Test your strategy with Backtesting
|
## Test your strategy with Backtesting
|
||||||
|
|
||||||
Now you have good Buy and Sell strategies and some historic data, you want to test it against
|
Now you have good Buy and Sell strategies and some historic data, you want to test it against
|
||||||
@ -20,7 +103,7 @@ The result of backtesting will confirm if your bot has better odds of making a p
|
|||||||
!!! 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](configuration.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.
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ This page provides you some basic concepts on how Freqtrade works and operates.
|
|||||||
|
|
||||||
## Freqtrade terminology
|
## Freqtrade terminology
|
||||||
|
|
||||||
|
* Strategy: Your trading strategy, telling the bot what to do.
|
||||||
* Trade: Open position.
|
* Trade: Open position.
|
||||||
* Open Order: Order which is currently placed on the exchange, and is not yet complete.
|
* Open Order: Order which is currently placed on the exchange, and is not yet complete.
|
||||||
* Pair: Tradable pair, usually in the format of Quote/Base (e.g. XRP/USDT).
|
* Pair: Tradable pair, usually in the format of Quote/Base (e.g. XRP/USDT).
|
||||||
|
@ -205,258 +205,6 @@ in production mode. Example command:
|
|||||||
freqtrade trade -c config.json --db-url sqlite:///tradesv3.dry_run.sqlite
|
freqtrade trade -c config.json --db-url sqlite:///tradesv3.dry_run.sqlite
|
||||||
```
|
```
|
||||||
|
|
||||||
## Backtesting commands
|
|
||||||
|
|
||||||
Backtesting also uses the config specified via `-c/--config`.
|
|
||||||
|
|
||||||
```
|
|
||||||
usage: freqtrade backtesting [-h] [-v] [--logfile FILE] [-V] [-c PATH]
|
|
||||||
[-d PATH] [--userdir PATH] [-s NAME]
|
|
||||||
[--strategy-path PATH] [-i TIMEFRAME]
|
|
||||||
[--timerange TIMERANGE]
|
|
||||||
[--data-format-ohlcv {json,jsongz,hdf5}]
|
|
||||||
[--max-open-trades INT]
|
|
||||||
[--stake-amount STAKE_AMOUNT] [--fee FLOAT]
|
|
||||||
[--eps] [--dmmp] [--enable-protections]
|
|
||||||
[--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]]
|
|
||||||
[--export EXPORT] [--export-filename PATH]
|
|
||||||
|
|
||||||
optional arguments:
|
|
||||||
-h, --help show this help message and exit
|
|
||||||
-i TIMEFRAME, --timeframe TIMEFRAME, --ticker-interval TIMEFRAME
|
|
||||||
Specify ticker interval (`1m`, `5m`, `30m`, `1h`,
|
|
||||||
`1d`).
|
|
||||||
--timerange TIMERANGE
|
|
||||||
Specify what timerange of data to use.
|
|
||||||
--data-format-ohlcv {json,jsongz,hdf5}
|
|
||||||
Storage format for downloaded candle (OHLCV) data.
|
|
||||||
(default: `None`).
|
|
||||||
--max-open-trades INT
|
|
||||||
Override the value of the `max_open_trades`
|
|
||||||
configuration setting.
|
|
||||||
--stake-amount STAKE_AMOUNT
|
|
||||||
Override the value of the `stake_amount` configuration
|
|
||||||
setting.
|
|
||||||
--fee FLOAT Specify fee ratio. Will be applied twice (on trade
|
|
||||||
entry and exit).
|
|
||||||
--eps, --enable-position-stacking
|
|
||||||
Allow buying the same pair multiple times (position
|
|
||||||
stacking).
|
|
||||||
--dmmp, --disable-max-market-positions
|
|
||||||
Disable applying `max_open_trades` during backtest
|
|
||||||
(same as setting `max_open_trades` to a very high
|
|
||||||
number).
|
|
||||||
--enable-protections, --enableprotections
|
|
||||||
Enable protections for backtesting.Will slow
|
|
||||||
backtesting down by a considerable amount, but will
|
|
||||||
include configured protections
|
|
||||||
--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]
|
|
||||||
Provide a space-separated list of strategies to
|
|
||||||
backtest. Please note that ticker-interval needs to be
|
|
||||||
set either in config or via command line. When using
|
|
||||||
this together with `--export trades`, the strategy-
|
|
||||||
name is injected into the filename (so `backtest-
|
|
||||||
data.json` becomes `backtest-data-
|
|
||||||
DefaultStrategy.json`
|
|
||||||
--export EXPORT Export backtest results, argument are: trades.
|
|
||||||
Example: `--export=trades`
|
|
||||||
--export-filename PATH
|
|
||||||
Save backtest results to the file with this filename.
|
|
||||||
Requires `--export` to be set as well. Example:
|
|
||||||
`--export-filename=user_data/backtest_results/backtest
|
|
||||||
_today.json`
|
|
||||||
|
|
||||||
Common arguments:
|
|
||||||
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
|
||||||
--logfile FILE Log to the file specified. Special values are:
|
|
||||||
'syslog', 'journald'. See the documentation for more
|
|
||||||
details.
|
|
||||||
-V, --version show program's version number and exit
|
|
||||||
-c PATH, --config PATH
|
|
||||||
Specify configuration file (default:
|
|
||||||
`userdir/config.json` or `config.json` whichever
|
|
||||||
exists). Multiple --config options may be used. Can be
|
|
||||||
set to `-` to read config from stdin.
|
|
||||||
-d PATH, --datadir PATH
|
|
||||||
Path to directory with historical backtesting data.
|
|
||||||
--userdir PATH, --user-data-dir PATH
|
|
||||||
Path to userdata directory.
|
|
||||||
|
|
||||||
Strategy arguments:
|
|
||||||
-s NAME, --strategy NAME
|
|
||||||
Specify strategy class name which will be used by the
|
|
||||||
bot.
|
|
||||||
--strategy-path PATH Specify additional strategy lookup path.
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
### Getting historic data for backtesting
|
|
||||||
|
|
||||||
The first time your run Backtesting, you will need to download some historic data first.
|
|
||||||
This can be accomplished by using `freqtrade download-data`.
|
|
||||||
Check the corresponding [Data Downloading](data-download.md) section for more details
|
|
||||||
|
|
||||||
## Hyperopt commands
|
|
||||||
|
|
||||||
To optimize your strategy, you can use hyperopt parameter hyperoptimization
|
|
||||||
to find optimal parameter values for your strategy.
|
|
||||||
|
|
||||||
```
|
|
||||||
usage: freqtrade hyperopt [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH]
|
|
||||||
[--userdir PATH] [-s NAME] [--strategy-path PATH]
|
|
||||||
[-i TIMEFRAME] [--timerange TIMERANGE]
|
|
||||||
[--data-format-ohlcv {json,jsongz,hdf5}]
|
|
||||||
[--max-open-trades INT]
|
|
||||||
[--stake-amount STAKE_AMOUNT] [--fee FLOAT]
|
|
||||||
[--hyperopt NAME] [--hyperopt-path PATH] [--eps]
|
|
||||||
[--dmmp] [--enable-protections] [-e INT]
|
|
||||||
[--spaces {all,buy,sell,roi,stoploss,trailing,default} [{all,buy,sell,roi,stoploss,trailing,default} ...]]
|
|
||||||
[--print-all] [--no-color] [--print-json] [-j JOBS]
|
|
||||||
[--random-state INT] [--min-trades INT]
|
|
||||||
[--hyperopt-loss NAME]
|
|
||||||
|
|
||||||
optional arguments:
|
|
||||||
-h, --help show this help message and exit
|
|
||||||
-i TIMEFRAME, --timeframe TIMEFRAME, --ticker-interval TIMEFRAME
|
|
||||||
Specify ticker interval (`1m`, `5m`, `30m`, `1h`,
|
|
||||||
`1d`).
|
|
||||||
--timerange TIMERANGE
|
|
||||||
Specify what timerange of data to use.
|
|
||||||
--data-format-ohlcv {json,jsongz,hdf5}
|
|
||||||
Storage format for downloaded candle (OHLCV) data.
|
|
||||||
(default: `None`).
|
|
||||||
--max-open-trades INT
|
|
||||||
Override the value of the `max_open_trades`
|
|
||||||
configuration setting.
|
|
||||||
--stake-amount STAKE_AMOUNT
|
|
||||||
Override the value of the `stake_amount` configuration
|
|
||||||
setting.
|
|
||||||
--fee FLOAT Specify fee ratio. Will be applied twice (on trade
|
|
||||||
entry and exit).
|
|
||||||
--hyperopt NAME Specify hyperopt class name which will be used by the
|
|
||||||
bot.
|
|
||||||
--hyperopt-path PATH Specify additional lookup path for Hyperopt and
|
|
||||||
Hyperopt Loss functions.
|
|
||||||
--eps, --enable-position-stacking
|
|
||||||
Allow buying the same pair multiple times (position
|
|
||||||
stacking).
|
|
||||||
--dmmp, --disable-max-market-positions
|
|
||||||
Disable applying `max_open_trades` during backtest
|
|
||||||
(same as setting `max_open_trades` to a very high
|
|
||||||
number).
|
|
||||||
--enable-protections, --enableprotections
|
|
||||||
Enable protections for backtesting.Will slow
|
|
||||||
backtesting down by a considerable amount, but will
|
|
||||||
include configured protections
|
|
||||||
-e INT, --epochs INT Specify number of epochs (default: 100).
|
|
||||||
--spaces {all,buy,sell,roi,stoploss,trailing,default} [{all,buy,sell,roi,stoploss,trailing,default} ...]
|
|
||||||
Specify which parameters to hyperopt. Space-separated
|
|
||||||
list.
|
|
||||||
--print-all Print all results, not only the best ones.
|
|
||||||
--no-color Disable colorization of hyperopt results. May be
|
|
||||||
useful if you are redirecting output to a file.
|
|
||||||
--print-json Print output in JSON format.
|
|
||||||
-j JOBS, --job-workers JOBS
|
|
||||||
The number of concurrently running jobs for
|
|
||||||
hyperoptimization (hyperopt worker processes). If -1
|
|
||||||
(default), all CPUs are used, for -2, all CPUs but one
|
|
||||||
are used, etc. If 1 is given, no parallel computing
|
|
||||||
code is used at all.
|
|
||||||
--random-state INT Set random state to some positive integer for
|
|
||||||
reproducible hyperopt results.
|
|
||||||
--min-trades INT Set minimal desired number of trades for evaluations
|
|
||||||
in the hyperopt optimization path (default: 1).
|
|
||||||
--hyperopt-loss NAME Specify the class name of the hyperopt loss function
|
|
||||||
class (IHyperOptLoss). Different functions can
|
|
||||||
generate completely different results, since the
|
|
||||||
target for optimization is different. Built-in
|
|
||||||
Hyperopt-loss-functions are:
|
|
||||||
ShortTradeDurHyperOptLoss, OnlyProfitHyperOptLoss,
|
|
||||||
SharpeHyperOptLoss, SharpeHyperOptLossDaily,
|
|
||||||
SortinoHyperOptLoss, SortinoHyperOptLossDaily
|
|
||||||
|
|
||||||
Common arguments:
|
|
||||||
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
|
||||||
--logfile FILE Log to the file specified. Special values are:
|
|
||||||
'syslog', 'journald'. See the documentation for more
|
|
||||||
details.
|
|
||||||
-V, --version show program's version number and exit
|
|
||||||
-c PATH, --config PATH
|
|
||||||
Specify configuration file (default:
|
|
||||||
`userdir/config.json` or `config.json` whichever
|
|
||||||
exists). Multiple --config options may be used. Can be
|
|
||||||
set to `-` to read config from stdin.
|
|
||||||
-d PATH, --datadir PATH
|
|
||||||
Path to directory with historical backtesting data.
|
|
||||||
--userdir PATH, --user-data-dir PATH
|
|
||||||
Path to userdata directory.
|
|
||||||
|
|
||||||
Strategy arguments:
|
|
||||||
-s NAME, --strategy NAME
|
|
||||||
Specify strategy class name which will be used by the
|
|
||||||
bot.
|
|
||||||
--strategy-path PATH Specify additional strategy lookup path.
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
## Edge commands
|
|
||||||
|
|
||||||
To know your trade expectancy and winrate against historical data, you can use Edge.
|
|
||||||
|
|
||||||
```
|
|
||||||
usage: freqtrade edge [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH]
|
|
||||||
[--userdir PATH] [-s NAME] [--strategy-path PATH]
|
|
||||||
[-i TIMEFRAME] [--timerange TIMERANGE]
|
|
||||||
[--max-open-trades INT] [--stake-amount STAKE_AMOUNT]
|
|
||||||
[--fee FLOAT] [--stoplosses STOPLOSS_RANGE]
|
|
||||||
|
|
||||||
optional arguments:
|
|
||||||
-h, --help show this help message and exit
|
|
||||||
-i TIMEFRAME, --timeframe TIMEFRAME, --ticker-interval TIMEFRAME
|
|
||||||
Specify ticker interval (`1m`, `5m`, `30m`, `1h`,
|
|
||||||
`1d`).
|
|
||||||
--timerange TIMERANGE
|
|
||||||
Specify what timerange of data to use.
|
|
||||||
--max-open-trades INT
|
|
||||||
Override the value of the `max_open_trades`
|
|
||||||
configuration setting.
|
|
||||||
--stake-amount STAKE_AMOUNT
|
|
||||||
Override the value of the `stake_amount` configuration
|
|
||||||
setting.
|
|
||||||
--fee FLOAT Specify fee ratio. Will be applied twice (on trade
|
|
||||||
entry and exit).
|
|
||||||
--stoplosses STOPLOSS_RANGE
|
|
||||||
Defines a range of stoploss values against which edge
|
|
||||||
will assess the strategy. The format is "min,max,step"
|
|
||||||
(without any space). Example:
|
|
||||||
`--stoplosses=-0.01,-0.1,-0.001`
|
|
||||||
|
|
||||||
Common arguments:
|
|
||||||
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
|
||||||
--logfile FILE Log to the file specified. Special values are:
|
|
||||||
'syslog', 'journald'. See the documentation for more
|
|
||||||
details.
|
|
||||||
-V, --version show program's version number and exit
|
|
||||||
-c PATH, --config PATH
|
|
||||||
Specify configuration file (default:
|
|
||||||
`userdir/config.json` or `config.json` whichever
|
|
||||||
exists). Multiple --config options may be used. Can be
|
|
||||||
set to `-` to read config from stdin.
|
|
||||||
-d PATH, --datadir PATH
|
|
||||||
Path to directory with historical backtesting data.
|
|
||||||
--userdir PATH, --user-data-dir PATH
|
|
||||||
Path to userdata directory.
|
|
||||||
|
|
||||||
Strategy arguments:
|
|
||||||
-s NAME, --strategy NAME
|
|
||||||
Specify strategy class name which will be used by the
|
|
||||||
bot.
|
|
||||||
--strategy-path PATH Specify additional strategy lookup path.
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
To understand edge and how to read the results, please read the [edge documentation](edge.md).
|
|
||||||
|
|
||||||
## Next step
|
## Next step
|
||||||
|
|
||||||
The optimal strategy of the bot will change with time depending of the market trends. The next step is to
|
The optimal strategy of the bot will change with time depending of the market trends. The next step is to
|
||||||
|
@ -91,8 +91,8 @@ Mandatory parameters are marked as **Required**, which means that they are requi
|
|||||||
| `exchange.skip_pair_validation` | Skip pairlist validation on startup.<br>*Defaults to `false`<br> **Datatype:** Boolean
|
| `exchange.skip_pair_validation` | Skip pairlist validation on startup.<br>*Defaults to `false`<br> **Datatype:** Boolean
|
||||||
| `edge.*` | Please refer to [edge configuration document](edge.md) for detailed explanation.
|
| `edge.*` | Please refer to [edge configuration document](edge.md) for detailed explanation.
|
||||||
| `experimental.block_bad_exchanges` | Block exchanges known to not work with freqtrade. Leave on default unless you want to test if that exchange works now. <br>*Defaults to `true`.* <br> **Datatype:** Boolean
|
| `experimental.block_bad_exchanges` | Block exchanges known to not work with freqtrade. Leave on default unless you want to test if that exchange works now. <br>*Defaults to `true`.* <br> **Datatype:** Boolean
|
||||||
| `pairlists` | Define one or more pairlists to be used. [More information below](#pairlists-and-pairlist-handlers). <br>*Defaults to `StaticPairList`.* <br> **Datatype:** List of Dicts
|
| `pairlists` | Define one or more pairlists to be used. [More information](plugins.md#pairlists-and-pairlist-handlers). <br>*Defaults to `StaticPairList`.* <br> **Datatype:** List of Dicts
|
||||||
| `protections` | Define one or more protections to be used. [More information below](#protections). [Strategy Override](#parameters-in-the-strategy). <br> **Datatype:** List of Dicts
|
| `protections` | Define one or more protections to be used. [More information](plugins.md#protections). [Strategy Override](#parameters-in-the-strategy). <br> **Datatype:** List of Dicts
|
||||||
| `telegram.enabled` | Enable the usage of Telegram. <br> **Datatype:** Boolean
|
| `telegram.enabled` | Enable the usage of Telegram. <br> **Datatype:** Boolean
|
||||||
| `telegram.token` | Your Telegram bot token. Only required if `telegram.enabled` is `true`. <br>**Keep it in secret, do not disclose publicly.** <br> **Datatype:** String
|
| `telegram.token` | Your Telegram bot token. Only required if `telegram.enabled` is `true`. <br>**Keep it in secret, do not disclose publicly.** <br> **Datatype:** String
|
||||||
| `telegram.chat_id` | Your personal Telegram account id. Only required if `telegram.enabled` is `true`. <br>**Keep it in secret, do not disclose publicly.** <br> **Datatype:** String
|
| `telegram.chat_id` | Your personal Telegram account id. Only required if `telegram.enabled` is `true`. <br>**Keep it in secret, do not disclose publicly.** <br> **Datatype:** String
|
||||||
@ -111,12 +111,12 @@ Mandatory parameters are marked as **Required**, which means that they are requi
|
|||||||
| `api_server.password` | Password for API server. See the [API Server documentation](rest-api.md) for more details. <br>**Keep it in secret, do not disclose publicly.**<br> **Datatype:** String
|
| `api_server.password` | Password for API server. See the [API Server documentation](rest-api.md) for more details. <br>**Keep it in secret, do not disclose publicly.**<br> **Datatype:** String
|
||||||
| `bot_name` | Name of the bot. Passed via API to a client - can be shown to distinguish / name bots.<br> *Defaults to `freqtrade`*<br> **Datatype:** String
|
| `bot_name` | Name of the bot. Passed via API to a client - can be shown to distinguish / name bots.<br> *Defaults to `freqtrade`*<br> **Datatype:** String
|
||||||
| `db_url` | Declares database URL to use. NOTE: This defaults to `sqlite:///tradesv3.dryrun.sqlite` if `dry_run` is `true`, and to `sqlite:///tradesv3.sqlite` for production instances. <br> **Datatype:** String, SQLAlchemy connect string
|
| `db_url` | Declares database URL to use. NOTE: This defaults to `sqlite:///tradesv3.dryrun.sqlite` if `dry_run` is `true`, and to `sqlite:///tradesv3.sqlite` for production instances. <br> **Datatype:** String, SQLAlchemy connect string
|
||||||
| `initial_state` | Defines the initial application state. More information below. <br>*Defaults to `stopped`.* <br> **Datatype:** Enum, either `stopped` or `running`
|
| `initial_state` | Defines the initial application state. If set to stopped, then the bot has to be explicitly started via `/start` RPC command. <br>*Defaults to `stopped`.* <br> **Datatype:** Enum, either `stopped` or `running`
|
||||||
| `forcebuy_enable` | Enables the RPC Commands to force a buy. More information below. <br> **Datatype:** Boolean
|
| `forcebuy_enable` | Enables the RPC Commands to force a buy. More information below. <br> **Datatype:** Boolean
|
||||||
| `disable_dataframe_checks` | Disable checking the OHLCV dataframe returned from the strategy methods for correctness. Only use when intentionally changing the dataframe and understand what you are doing. [Strategy Override](#parameters-in-the-strategy).<br> *Defaults to `False`*. <br> **Datatype:** Boolean
|
| `disable_dataframe_checks` | Disable checking the OHLCV dataframe returned from the strategy methods for correctness. Only use when intentionally changing the dataframe and understand what you are doing. [Strategy Override](#parameters-in-the-strategy).<br> *Defaults to `False`*. <br> **Datatype:** Boolean
|
||||||
| `strategy` | **Required** Defines Strategy class to use. Recommended to be set via `--strategy NAME`. <br> **Datatype:** ClassName
|
| `strategy` | **Required** Defines Strategy class to use. Recommended to be set via `--strategy NAME`. <br> **Datatype:** ClassName
|
||||||
| `strategy_path` | Adds an additional strategy lookup path (must be a directory). <br> **Datatype:** String
|
| `strategy_path` | Adds an additional strategy lookup path (must be a directory). <br> **Datatype:** String
|
||||||
| `internals.process_throttle_secs` | Set the process throttle. Value in second. <br>*Defaults to `5` seconds.* <br> **Datatype:** Positive Integer
|
| `internals.process_throttle_secs` | Set the process throttle, or minimum loop duration for one bot iteration loop. Value in second. <br>*Defaults to `5` seconds.* <br> **Datatype:** Positive Integer
|
||||||
| `internals.heartbeat_interval` | Print heartbeat message every N seconds. Set to 0 to disable heartbeat messages. <br>*Defaults to `60` seconds.* <br> **Datatype:** Positive Integer or 0
|
| `internals.heartbeat_interval` | Print heartbeat message every N seconds. Set to 0 to disable heartbeat messages. <br>*Defaults to `60` seconds.* <br> **Datatype:** Positive Integer or 0
|
||||||
| `internals.sd_notify` | Enables use of the sd_notify protocol to tell systemd service manager about changes in the bot state and issue keep-alive pings. See [here](installation.md#7-optional-configure-freqtrade-as-a-systemd-service) for more details. <br> **Datatype:** Boolean
|
| `internals.sd_notify` | Enables use of the sd_notify protocol to tell systemd service manager about changes in the bot state and issue keep-alive pings. See [here](installation.md#7-optional-configure-freqtrade-as-a-systemd-service) for more details. <br> **Datatype:** Boolean
|
||||||
| `logfile` | Specifies logfile name. Uses a rolling strategy for log file rotation for 10 files with the 1MB limit per file. <br> **Datatype:** String
|
| `logfile` | Specifies logfile name. Uses a rolling strategy for log file rotation for 10 files with the 1MB limit per file. <br> **Datatype:** String
|
||||||
@ -246,38 +246,16 @@ If it is not set in either Strategy or Configuration, a default of 1000% `{"0":
|
|||||||
!!! Note "Special case to forcesell after a specific time"
|
!!! Note "Special case to forcesell after a specific time"
|
||||||
A special case presents using `"<N>": -1` as ROI. This forces the bot to sell a trade after N Minutes, no matter if it's positive or negative, so represents a time-limited force-sell.
|
A special case presents using `"<N>": -1` as ROI. This forces the bot to sell a trade after N Minutes, no matter if it's positive or negative, so represents a time-limited force-sell.
|
||||||
|
|
||||||
### Understand stoploss
|
|
||||||
|
|
||||||
Go to the [stoploss documentation](stoploss.md) for more details.
|
|
||||||
|
|
||||||
### Understand trailing stoploss
|
|
||||||
|
|
||||||
Go to the [trailing stoploss Documentation](stoploss.md#trailing-stop-loss) for details on trailing stoploss.
|
|
||||||
|
|
||||||
### Understand initial_state
|
|
||||||
|
|
||||||
The `initial_state` configuration parameter is an optional field that defines the initial application state.
|
|
||||||
Possible values are `running` or `stopped`. (default=`running`)
|
|
||||||
If the value is `stopped` the bot has to be started with `/start` first.
|
|
||||||
|
|
||||||
### Understand forcebuy_enable
|
### Understand forcebuy_enable
|
||||||
|
|
||||||
The `forcebuy_enable` configuration parameter enables the usage of forcebuy commands via Telegram.
|
The `forcebuy_enable` configuration parameter enables the usage of forcebuy commands via Telegram and REST API.
|
||||||
This is disabled for security reasons by default, and will show a warning message on startup if enabled.
|
For security reasons, it's disabled by default, and freqtrade will show a warning message on startup if enabled.
|
||||||
For example, you can send `/forcebuy ETH/BTC` Telegram command when this feature if enabled to the bot,
|
For example, you can send `/forcebuy ETH/BTC` to the bot, which will result in freqtrade buying the pair and holds it until a regular sell-signal (ROI, stoploss, /forcesell) appears.
|
||||||
who then buys the pair and holds it until a regular sell-signal (ROI, stoploss, /forcesell) appears.
|
|
||||||
|
|
||||||
This can be dangerous with some strategies, so use with care.
|
This can be dangerous with some strategies, so use with care.
|
||||||
|
|
||||||
See [the telegram documentation](telegram-usage.md) for details on usage.
|
See [the telegram documentation](telegram-usage.md) for details on usage.
|
||||||
|
|
||||||
### Understand process_throttle_secs
|
|
||||||
|
|
||||||
The `process_throttle_secs` configuration parameter is an optional field that defines in seconds how long the bot should wait
|
|
||||||
before asking the strategy if we should buy or a sell an asset. After each wait period, the strategy is asked again for
|
|
||||||
every opened trade wether or not we should sell, and for all the remaining pairs (either the dynamic list of pairs or
|
|
||||||
the static list of pairs) if we should buy.
|
|
||||||
|
|
||||||
### Ignoring expired candles
|
### Ignoring expired candles
|
||||||
|
|
||||||
When working with larger timeframes (for example 1h or more) and using a low `max_open_trades` value, the last candle can be processed as soon as a trade slot becomes available. When processing the last candle, this can lead to a situation where it may not be desirable to use the buy signal on that candle. For example, when using a condition in your strategy where you use a cross-over, that point may have passed too long ago for you to start a trade on it.
|
When working with larger timeframes (for example 1h or more) and using a low `max_open_trades` value, the last candle can be processed as soon as a trade slot becomes available. When processing the last candle, this can lead to a situation where it may not be desirable to use the buy signal on that candle. For example, when using a condition in your strategy where you use a cross-over, that point may have passed too long ago for you to start a trade on it.
|
||||||
@ -470,137 +448,9 @@ The valid values are:
|
|||||||
"BTC", "ETH", "XRP", "LTC", "BCH", "USDT"
|
"BTC", "ETH", "XRP", "LTC", "BCH", "USDT"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Prices used for orders
|
--8<-- "includes/pricing.md"
|
||||||
|
|
||||||
Prices for regular orders can be controlled via the parameter structures `bid_strategy` for buying and `ask_strategy` for selling.
|
## Using Dry-run mode
|
||||||
Prices are always retrieved right before an order is placed, either by querying the exchange tickers or by using the orderbook data.
|
|
||||||
|
|
||||||
!!! Note
|
|
||||||
Orderbook data used by Freqtrade are the data retrieved from exchange by the ccxt's function `fetch_order_book()`, i.e. are usually data from the L2-aggregated orderbook, while the ticker data are the structures returned by the ccxt's `fetch_ticker()`/`fetch_tickers()` functions. Refer to the ccxt library [documentation](https://github.com/ccxt/ccxt/wiki/Manual#market-data) for more details.
|
|
||||||
|
|
||||||
!!! Warning "Using market orders"
|
|
||||||
Please read the section [Market order pricing](#market-order-pricing) section when using market orders.
|
|
||||||
|
|
||||||
### Buy price
|
|
||||||
|
|
||||||
#### Check depth of market
|
|
||||||
|
|
||||||
When check depth of market is enabled (`bid_strategy.check_depth_of_market.enabled=True`), the buy signals are filtered based on the orderbook depth (sum of all amounts) for each orderbook side.
|
|
||||||
|
|
||||||
Orderbook `bid` (buy) side depth is then divided by the orderbook `ask` (sell) side depth and the resulting delta is compared to the value of the `bid_strategy.check_depth_of_market.bids_to_ask_delta` parameter. The buy order is only executed if the orderbook delta is greater than or equal to the configured delta value.
|
|
||||||
|
|
||||||
!!! Note
|
|
||||||
A delta value below 1 means that `ask` (sell) orderbook side depth is greater than the depth of the `bid` (buy) orderbook side, while a value greater than 1 means opposite (depth of the buy side is higher than the depth of the sell side).
|
|
||||||
|
|
||||||
#### Buy price side
|
|
||||||
|
|
||||||
The configuration setting `bid_strategy.price_side` defines the side of the spread the bot looks for when buying.
|
|
||||||
|
|
||||||
The following displays an orderbook.
|
|
||||||
|
|
||||||
``` explanation
|
|
||||||
...
|
|
||||||
103
|
|
||||||
102
|
|
||||||
101 # ask
|
|
||||||
-------------Current spread
|
|
||||||
99 # bid
|
|
||||||
98
|
|
||||||
97
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
If `bid_strategy.price_side` is set to `"bid"`, then the bot will use 99 as buying price.
|
|
||||||
In line with that, if `bid_strategy.price_side` is set to `"ask"`, then the bot will use 101 as buying price.
|
|
||||||
|
|
||||||
Using `ask` price often guarantees quicker filled orders, but the bot can also end up paying more than what would have been necessary.
|
|
||||||
Taker fees instead of maker fees will most likely apply even when using limit buy orders.
|
|
||||||
Also, prices at the "ask" side of the spread are higher than prices at the "bid" side in the orderbook, so the order behaves similar to a market order (however with a maximum price).
|
|
||||||
|
|
||||||
#### Buy price with Orderbook enabled
|
|
||||||
|
|
||||||
When buying with the orderbook enabled (`bid_strategy.use_order_book=True`), Freqtrade fetches the `bid_strategy.order_book_top` entries from the orderbook and then uses the entry specified as `bid_strategy.order_book_top` on the configured side (`bid_strategy.price_side`) of the orderbook. 1 specifies the topmost entry in the orderbook, while 2 would use the 2nd entry in the orderbook, and so on.
|
|
||||||
|
|
||||||
#### Buy price without Orderbook enabled
|
|
||||||
|
|
||||||
The following section uses `side` as the configured `bid_strategy.price_side`.
|
|
||||||
|
|
||||||
When not using orderbook (`bid_strategy.use_order_book=False`), Freqtrade uses the best `side` price from the ticker if it's below the `last` traded price from the ticker. Otherwise (when the `side` price is above the `last` price), it calculates a rate between `side` and `last` price.
|
|
||||||
|
|
||||||
The `bid_strategy.ask_last_balance` configuration parameter controls this. A value of `0.0` will use `side` price, while `1.0` will use the `last` price and values between those interpolate between ask and last price.
|
|
||||||
|
|
||||||
### Sell price
|
|
||||||
|
|
||||||
#### Sell price side
|
|
||||||
|
|
||||||
The configuration setting `ask_strategy.price_side` defines the side of the spread the bot looks for when selling.
|
|
||||||
|
|
||||||
The following displays an orderbook:
|
|
||||||
|
|
||||||
``` explanation
|
|
||||||
...
|
|
||||||
103
|
|
||||||
102
|
|
||||||
101 # ask
|
|
||||||
-------------Current spread
|
|
||||||
99 # bid
|
|
||||||
98
|
|
||||||
97
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
If `ask_strategy.price_side` is set to `"ask"`, then the bot will use 101 as selling price.
|
|
||||||
In line with that, if `ask_strategy.price_side` is set to `"bid"`, then the bot will use 99 as selling price.
|
|
||||||
|
|
||||||
#### Sell price with Orderbook enabled
|
|
||||||
|
|
||||||
When selling with the orderbook enabled (`ask_strategy.use_order_book=True`), Freqtrade fetches the `ask_strategy.order_book_max` entries in the orderbook. Then each of the orderbook steps between `ask_strategy.order_book_min` and `ask_strategy.order_book_max` on the configured orderbook side are validated for a profitable sell-possibility based on the strategy configuration (`minimal_roi` conditions) and the sell order is placed at the first profitable spot.
|
|
||||||
|
|
||||||
!!! Note
|
|
||||||
Using `order_book_max` higher than `order_book_min` only makes sense when ask_strategy.price_side is set to `"ask"`.
|
|
||||||
|
|
||||||
The idea here is to place the sell order early, to be ahead in the queue.
|
|
||||||
|
|
||||||
A fixed slot (mirroring `bid_strategy.order_book_top`) can be defined by setting `ask_strategy.order_book_min` and `ask_strategy.order_book_max` to the same number.
|
|
||||||
|
|
||||||
!!! Warning "Order_book_max > 1 - increased risks for stoplosses!"
|
|
||||||
Using `ask_strategy.order_book_max` higher than 1 will increase the risk the stoploss on exchange is cancelled too early, since an eventual [stoploss on exchange](#understand-order_types) will be cancelled as soon as the order is placed.
|
|
||||||
Also, the sell order will remain on the exchange for `unfilledtimeout.sell` (or until it's filled) - which can lead to missed stoplosses (with or without using stoploss on exchange).
|
|
||||||
|
|
||||||
!!! Warning "Order_book_max > 1 in dry-run"
|
|
||||||
Using `ask_strategy.order_book_max` higher than 1 will result in improper dry-run results (significantly better than real orders executed on exchange), since dry-run assumes orders to be filled almost instantly.
|
|
||||||
It is therefore advised to not use this setting for dry-runs.
|
|
||||||
|
|
||||||
#### Sell price without Orderbook enabled
|
|
||||||
|
|
||||||
When not using orderbook (`ask_strategy.use_order_book=False`), the price at the `ask_strategy.price_side` side (defaults to `"ask"`) from the ticker will be used as the sell price.
|
|
||||||
|
|
||||||
### Market order pricing
|
|
||||||
|
|
||||||
When using market orders, prices should be configured to use the "correct" side of the orderbook to allow realistic pricing detection.
|
|
||||||
Assuming both buy and sell are using market orders, a configuration similar to the following might be used
|
|
||||||
|
|
||||||
``` jsonc
|
|
||||||
"order_types": {
|
|
||||||
"buy": "market",
|
|
||||||
"sell": "market"
|
|
||||||
// ...
|
|
||||||
},
|
|
||||||
"bid_strategy": {
|
|
||||||
"price_side": "ask",
|
|
||||||
// ...
|
|
||||||
},
|
|
||||||
"ask_strategy":{
|
|
||||||
"price_side": "bid",
|
|
||||||
// ...
|
|
||||||
},
|
|
||||||
```
|
|
||||||
|
|
||||||
Obviously, if only one side is using limit orders, different pricing combinations can be used.
|
|
||||||
--8<-- "includes/pairlists.md"
|
|
||||||
--8<-- "includes/protections.md"
|
|
||||||
|
|
||||||
## Switch to Dry-run mode
|
|
||||||
|
|
||||||
We recommend starting the bot in the Dry-run mode to see how your bot will
|
We recommend starting the bot in the Dry-run mode to see how your bot will
|
||||||
behave and what is the performance of your strategy. In the Dry-run mode the
|
behave and what is the performance of your strategy. In the Dry-run mode the
|
||||||
@ -633,9 +483,10 @@ Once you will be happy with your bot performance running in the Dry-run mode, yo
|
|||||||
|
|
||||||
### Considerations for dry-run
|
### Considerations for dry-run
|
||||||
|
|
||||||
* API-keys may or may not be provided. Only Read-Only operations (i.e. operations that do not alter account state) on the exchange are performed in the dry-run mode.
|
* API-keys may or may not be provided. Only Read-Only operations (i.e. operations that do not alter account state) on the exchange are performed in dry-run mode.
|
||||||
* Wallets (`/balance`) are simulated.
|
* Wallets (`/balance`) are simulated based on `dry_run_wallet`.
|
||||||
* Orders are simulated, and will not be posted to the exchange.
|
* Orders are simulated, and will not be posted to the exchange.
|
||||||
|
* Orders are assumed to fill immediately, and will never time out.
|
||||||
* In combination with `stoploss_on_exchange`, the stop_loss price is assumed to be filled.
|
* In combination with `stoploss_on_exchange`, the stop_loss price is assumed to be filled.
|
||||||
* Open orders (not trades, which are stored in the database) are reset on bot restart.
|
* Open orders (not trades, which are stored in the database) are reset on bot restart.
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ In `VolumePairList`, this implements different methods of sorting, does early va
|
|||||||
|
|
||||||
### Protections
|
### Protections
|
||||||
|
|
||||||
Best read the [Protection documentation](configuration.md#protections) to understand protections.
|
Best read the [Protection documentation](plugins.md#protections) to understand protections.
|
||||||
This Guide is directed towards Developers who want to develop a new protection.
|
This Guide is directed towards Developers who want to develop a new protection.
|
||||||
|
|
||||||
No protection should use datetime directly, but use the provided `date_now` variable for date calculations. This preserves the ability to backtest protections.
|
No protection should use datetime directly, but use the provided `date_now` variable for date calculations. This preserves the ability to backtest protections.
|
||||||
|
55
docs/edge.md
55
docs/edge.md
@ -9,6 +9,7 @@ The `Edge Positioning` module uses probability to calculate your win rate and ri
|
|||||||
`Edge Positioning` only considers *its own* buy/sell/stoploss signals. It ignores the stoploss, trailing stoploss, and ROI settings in the strategy configuration file.
|
`Edge Positioning` only considers *its own* buy/sell/stoploss signals. It ignores the stoploss, trailing stoploss, and ROI settings in the strategy configuration file.
|
||||||
`Edge Positioning` improves the performance of some trading strategies and *decreases* the performance of others.
|
`Edge Positioning` improves the performance of some trading strategies and *decreases* the performance of others.
|
||||||
|
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
Trading strategies are not perfect. They are frameworks that are susceptible to the market and its indicators. Because the market is not at all predictable, sometimes a strategy will win and sometimes the same strategy will lose.
|
Trading strategies are not perfect. They are frameworks that are susceptible to the market and its indicators. Because the market is not at all predictable, sometimes a strategy will win and sometimes the same strategy will lose.
|
||||||
@ -208,6 +209,60 @@ Let's say the stake currency is **ETH** and there is $10$ **ETH** on the wallet.
|
|||||||
|
|
||||||
- **Trade 4** The strategy detects a new buy signal int the **XLM/ETH** market. `Edge Positioning` calculates the stoploss of $2\%$, and the position size of $0.055 / 0.02 = 2.75$ **ETH**.
|
- **Trade 4** The strategy detects a new buy signal int the **XLM/ETH** market. `Edge Positioning` calculates the stoploss of $2\%$, and the position size of $0.055 / 0.02 = 2.75$ **ETH**.
|
||||||
|
|
||||||
|
## Edge command reference
|
||||||
|
|
||||||
|
```
|
||||||
|
usage: freqtrade edge [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH]
|
||||||
|
[--userdir PATH] [-s NAME] [--strategy-path PATH]
|
||||||
|
[-i TIMEFRAME] [--timerange TIMERANGE]
|
||||||
|
[--max-open-trades INT] [--stake-amount STAKE_AMOUNT]
|
||||||
|
[--fee FLOAT] [--stoplosses STOPLOSS_RANGE]
|
||||||
|
|
||||||
|
optional arguments:
|
||||||
|
-h, --help show this help message and exit
|
||||||
|
-i TIMEFRAME, --timeframe TIMEFRAME, --ticker-interval TIMEFRAME
|
||||||
|
Specify ticker interval (`1m`, `5m`, `30m`, `1h`,
|
||||||
|
`1d`).
|
||||||
|
--timerange TIMERANGE
|
||||||
|
Specify what timerange of data to use.
|
||||||
|
--max-open-trades INT
|
||||||
|
Override the value of the `max_open_trades`
|
||||||
|
configuration setting.
|
||||||
|
--stake-amount STAKE_AMOUNT
|
||||||
|
Override the value of the `stake_amount` configuration
|
||||||
|
setting.
|
||||||
|
--fee FLOAT Specify fee ratio. Will be applied twice (on trade
|
||||||
|
entry and exit).
|
||||||
|
--stoplosses STOPLOSS_RANGE
|
||||||
|
Defines a range of stoploss values against which edge
|
||||||
|
will assess the strategy. The format is "min,max,step"
|
||||||
|
(without any space). Example:
|
||||||
|
`--stoplosses=-0.01,-0.1,-0.001`
|
||||||
|
|
||||||
|
Common arguments:
|
||||||
|
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
||||||
|
--logfile FILE Log to the file specified. Special values are:
|
||||||
|
'syslog', 'journald'. See the documentation for more
|
||||||
|
details.
|
||||||
|
-V, --version show program's version number and exit
|
||||||
|
-c PATH, --config PATH
|
||||||
|
Specify configuration file (default:
|
||||||
|
`userdir/config.json` or `config.json` whichever
|
||||||
|
exists). Multiple --config options may be used. Can be
|
||||||
|
set to `-` to read config from stdin.
|
||||||
|
-d PATH, --datadir PATH
|
||||||
|
Path to directory with historical backtesting data.
|
||||||
|
--userdir PATH, --user-data-dir PATH
|
||||||
|
Path to userdata directory.
|
||||||
|
|
||||||
|
Strategy arguments:
|
||||||
|
-s NAME, --strategy NAME
|
||||||
|
Specify strategy class name which will be used by the
|
||||||
|
bot.
|
||||||
|
--strategy-path PATH Specify additional strategy lookup path.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
## Configurations
|
## Configurations
|
||||||
|
|
||||||
Edge module has following configuration options:
|
Edge module has following configuration options:
|
||||||
|
101
docs/hyperopt.md
101
docs/hyperopt.md
@ -32,6 +32,107 @@ source .env/bin/activate
|
|||||||
pip install -r requirements-hyperopt.txt
|
pip install -r requirements-hyperopt.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Hyperopt command reference
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
usage: freqtrade hyperopt [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH]
|
||||||
|
[--userdir PATH] [-s NAME] [--strategy-path PATH]
|
||||||
|
[-i TIMEFRAME] [--timerange TIMERANGE]
|
||||||
|
[--data-format-ohlcv {json,jsongz,hdf5}]
|
||||||
|
[--max-open-trades INT]
|
||||||
|
[--stake-amount STAKE_AMOUNT] [--fee FLOAT]
|
||||||
|
[--hyperopt NAME] [--hyperopt-path PATH] [--eps]
|
||||||
|
[--dmmp] [--enable-protections] [-e INT]
|
||||||
|
[--spaces {all,buy,sell,roi,stoploss,trailing,default} [{all,buy,sell,roi,stoploss,trailing,default} ...]]
|
||||||
|
[--print-all] [--no-color] [--print-json] [-j JOBS]
|
||||||
|
[--random-state INT] [--min-trades INT]
|
||||||
|
[--hyperopt-loss NAME]
|
||||||
|
|
||||||
|
optional arguments:
|
||||||
|
-h, --help show this help message and exit
|
||||||
|
-i TIMEFRAME, --timeframe TIMEFRAME, --ticker-interval TIMEFRAME
|
||||||
|
Specify ticker interval (`1m`, `5m`, `30m`, `1h`,
|
||||||
|
`1d`).
|
||||||
|
--timerange TIMERANGE
|
||||||
|
Specify what timerange of data to use.
|
||||||
|
--data-format-ohlcv {json,jsongz,hdf5}
|
||||||
|
Storage format for downloaded candle (OHLCV) data.
|
||||||
|
(default: `None`).
|
||||||
|
--max-open-trades INT
|
||||||
|
Override the value of the `max_open_trades`
|
||||||
|
configuration setting.
|
||||||
|
--stake-amount STAKE_AMOUNT
|
||||||
|
Override the value of the `stake_amount` configuration
|
||||||
|
setting.
|
||||||
|
--fee FLOAT Specify fee ratio. Will be applied twice (on trade
|
||||||
|
entry and exit).
|
||||||
|
--hyperopt NAME Specify hyperopt class name which will be used by the
|
||||||
|
bot.
|
||||||
|
--hyperopt-path PATH Specify additional lookup path for Hyperopt and
|
||||||
|
Hyperopt Loss functions.
|
||||||
|
--eps, --enable-position-stacking
|
||||||
|
Allow buying the same pair multiple times (position
|
||||||
|
stacking).
|
||||||
|
--dmmp, --disable-max-market-positions
|
||||||
|
Disable applying `max_open_trades` during backtest
|
||||||
|
(same as setting `max_open_trades` to a very high
|
||||||
|
number).
|
||||||
|
--enable-protections, --enableprotections
|
||||||
|
Enable protections for backtesting.Will slow
|
||||||
|
backtesting down by a considerable amount, but will
|
||||||
|
include configured protections
|
||||||
|
-e INT, --epochs INT Specify number of epochs (default: 100).
|
||||||
|
--spaces {all,buy,sell,roi,stoploss,trailing,default} [{all,buy,sell,roi,stoploss,trailing,default} ...]
|
||||||
|
Specify which parameters to hyperopt. Space-separated
|
||||||
|
list.
|
||||||
|
--print-all Print all results, not only the best ones.
|
||||||
|
--no-color Disable colorization of hyperopt results. May be
|
||||||
|
useful if you are redirecting output to a file.
|
||||||
|
--print-json Print output in JSON format.
|
||||||
|
-j JOBS, --job-workers JOBS
|
||||||
|
The number of concurrently running jobs for
|
||||||
|
hyperoptimization (hyperopt worker processes). If -1
|
||||||
|
(default), all CPUs are used, for -2, all CPUs but one
|
||||||
|
are used, etc. If 1 is given, no parallel computing
|
||||||
|
code is used at all.
|
||||||
|
--random-state INT Set random state to some positive integer for
|
||||||
|
reproducible hyperopt results.
|
||||||
|
--min-trades INT Set minimal desired number of trades for evaluations
|
||||||
|
in the hyperopt optimization path (default: 1).
|
||||||
|
--hyperopt-loss NAME Specify the class name of the hyperopt loss function
|
||||||
|
class (IHyperOptLoss). Different functions can
|
||||||
|
generate completely different results, since the
|
||||||
|
target for optimization is different. Built-in
|
||||||
|
Hyperopt-loss-functions are:
|
||||||
|
ShortTradeDurHyperOptLoss, OnlyProfitHyperOptLoss,
|
||||||
|
SharpeHyperOptLoss, SharpeHyperOptLossDaily,
|
||||||
|
SortinoHyperOptLoss, SortinoHyperOptLossDaily
|
||||||
|
|
||||||
|
Common arguments:
|
||||||
|
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
||||||
|
--logfile FILE Log to the file specified. Special values are:
|
||||||
|
'syslog', 'journald'. See the documentation for more
|
||||||
|
details.
|
||||||
|
-V, --version show program's version number and exit
|
||||||
|
-c PATH, --config PATH
|
||||||
|
Specify configuration file (default:
|
||||||
|
`userdir/config.json` or `config.json` whichever
|
||||||
|
exists). Multiple --config options may be used. Can be
|
||||||
|
set to `-` to read config from stdin.
|
||||||
|
-d PATH, --datadir PATH
|
||||||
|
Path to directory with historical backtesting data.
|
||||||
|
--userdir PATH, --user-data-dir PATH
|
||||||
|
Path to userdata directory.
|
||||||
|
|
||||||
|
Strategy arguments:
|
||||||
|
-s NAME, --strategy NAME
|
||||||
|
Specify strategy class name which will be used by the
|
||||||
|
bot.
|
||||||
|
--strategy-path PATH Specify additional strategy lookup path.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
## Prepare Hyperopting
|
## Prepare Hyperopting
|
||||||
|
|
||||||
Before we start digging into Hyperopt, we recommend you to take a look at
|
Before we start digging into Hyperopt, we recommend you to take a look at
|
||||||
|
127
docs/includes/pricing.md
Normal file
127
docs/includes/pricing.md
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
## Prices used for orders
|
||||||
|
|
||||||
|
Prices for regular orders can be controlled via the parameter structures `bid_strategy` for buying and `ask_strategy` for selling.
|
||||||
|
Prices are always retrieved right before an order is placed, either by querying the exchange tickers or by using the orderbook data.
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
Orderbook data used by Freqtrade are the data retrieved from exchange by the ccxt's function `fetch_order_book()`, i.e. are usually data from the L2-aggregated orderbook, while the ticker data are the structures returned by the ccxt's `fetch_ticker()`/`fetch_tickers()` functions. Refer to the ccxt library [documentation](https://github.com/ccxt/ccxt/wiki/Manual#market-data) for more details.
|
||||||
|
|
||||||
|
!!! Warning "Using market orders"
|
||||||
|
Please read the section [Market order pricing](#market-order-pricing) section when using market orders.
|
||||||
|
|
||||||
|
### Buy price
|
||||||
|
|
||||||
|
#### Check depth of market
|
||||||
|
|
||||||
|
When check depth of market is enabled (`bid_strategy.check_depth_of_market.enabled=True`), the buy signals are filtered based on the orderbook depth (sum of all amounts) for each orderbook side.
|
||||||
|
|
||||||
|
Orderbook `bid` (buy) side depth is then divided by the orderbook `ask` (sell) side depth and the resulting delta is compared to the value of the `bid_strategy.check_depth_of_market.bids_to_ask_delta` parameter. The buy order is only executed if the orderbook delta is greater than or equal to the configured delta value.
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
A delta value below 1 means that `ask` (sell) orderbook side depth is greater than the depth of the `bid` (buy) orderbook side, while a value greater than 1 means opposite (depth of the buy side is higher than the depth of the sell side).
|
||||||
|
|
||||||
|
#### Buy price side
|
||||||
|
|
||||||
|
The configuration setting `bid_strategy.price_side` defines the side of the spread the bot looks for when buying.
|
||||||
|
|
||||||
|
The following displays an orderbook.
|
||||||
|
|
||||||
|
``` explanation
|
||||||
|
...
|
||||||
|
103
|
||||||
|
102
|
||||||
|
101 # ask
|
||||||
|
-------------Current spread
|
||||||
|
99 # bid
|
||||||
|
98
|
||||||
|
97
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
If `bid_strategy.price_side` is set to `"bid"`, then the bot will use 99 as buying price.
|
||||||
|
In line with that, if `bid_strategy.price_side` is set to `"ask"`, then the bot will use 101 as buying price.
|
||||||
|
|
||||||
|
Using `ask` price often guarantees quicker filled orders, but the bot can also end up paying more than what would have been necessary.
|
||||||
|
Taker fees instead of maker fees will most likely apply even when using limit buy orders.
|
||||||
|
Also, prices at the "ask" side of the spread are higher than prices at the "bid" side in the orderbook, so the order behaves similar to a market order (however with a maximum price).
|
||||||
|
|
||||||
|
#### Buy price with Orderbook enabled
|
||||||
|
|
||||||
|
When buying with the orderbook enabled (`bid_strategy.use_order_book=True`), Freqtrade fetches the `bid_strategy.order_book_top` entries from the orderbook and then uses the entry specified as `bid_strategy.order_book_top` on the configured side (`bid_strategy.price_side`) of the orderbook. 1 specifies the topmost entry in the orderbook, while 2 would use the 2nd entry in the orderbook, and so on.
|
||||||
|
|
||||||
|
#### Buy price without Orderbook enabled
|
||||||
|
|
||||||
|
The following section uses `side` as the configured `bid_strategy.price_side`.
|
||||||
|
|
||||||
|
When not using orderbook (`bid_strategy.use_order_book=False`), Freqtrade uses the best `side` price from the ticker if it's below the `last` traded price from the ticker. Otherwise (when the `side` price is above the `last` price), it calculates a rate between `side` and `last` price.
|
||||||
|
|
||||||
|
The `bid_strategy.ask_last_balance` configuration parameter controls this. A value of `0.0` will use `side` price, while `1.0` will use the `last` price and values between those interpolate between ask and last price.
|
||||||
|
|
||||||
|
### Sell price
|
||||||
|
|
||||||
|
#### Sell price side
|
||||||
|
|
||||||
|
The configuration setting `ask_strategy.price_side` defines the side of the spread the bot looks for when selling.
|
||||||
|
|
||||||
|
The following displays an orderbook:
|
||||||
|
|
||||||
|
``` explanation
|
||||||
|
...
|
||||||
|
103
|
||||||
|
102
|
||||||
|
101 # ask
|
||||||
|
-------------Current spread
|
||||||
|
99 # bid
|
||||||
|
98
|
||||||
|
97
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
If `ask_strategy.price_side` is set to `"ask"`, then the bot will use 101 as selling price.
|
||||||
|
In line with that, if `ask_strategy.price_side` is set to `"bid"`, then the bot will use 99 as selling price.
|
||||||
|
|
||||||
|
#### Sell price with Orderbook enabled
|
||||||
|
|
||||||
|
When selling with the orderbook enabled (`ask_strategy.use_order_book=True`), Freqtrade fetches the `ask_strategy.order_book_max` entries in the orderbook. Then each of the orderbook steps between `ask_strategy.order_book_min` and `ask_strategy.order_book_max` on the configured orderbook side are validated for a profitable sell-possibility based on the strategy configuration (`minimal_roi` conditions) and the sell order is placed at the first profitable spot.
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
Using `order_book_max` higher than `order_book_min` only makes sense when ask_strategy.price_side is set to `"ask"`.
|
||||||
|
|
||||||
|
The idea here is to place the sell order early, to be ahead in the queue.
|
||||||
|
|
||||||
|
A fixed slot (mirroring `bid_strategy.order_book_top`) can be defined by setting `ask_strategy.order_book_min` and `ask_strategy.order_book_max` to the same number.
|
||||||
|
|
||||||
|
!!! Warning "Order_book_max > 1 - increased risks for stoplosses!"
|
||||||
|
Using `ask_strategy.order_book_max` higher than 1 will increase the risk the stoploss on exchange is cancelled too early, since an eventual [stoploss on exchange](#understand-order_types) will be cancelled as soon as the order is placed.
|
||||||
|
Also, the sell order will remain on the exchange for `unfilledtimeout.sell` (or until it's filled) - which can lead to missed stoplosses (with or without using stoploss on exchange).
|
||||||
|
|
||||||
|
!!! Warning "Order_book_max > 1 in dry-run"
|
||||||
|
Using `ask_strategy.order_book_max` higher than 1 will result in improper dry-run results (significantly better than real orders executed on exchange), since dry-run assumes orders to be filled almost instantly.
|
||||||
|
It is therefore advised to not use this setting for dry-runs.
|
||||||
|
|
||||||
|
#### Sell price without Orderbook enabled
|
||||||
|
|
||||||
|
When not using orderbook (`ask_strategy.use_order_book=False`), the price at the `ask_strategy.price_side` side (defaults to `"ask"`) from the ticker will be used as the sell price.
|
||||||
|
|
||||||
|
### Market order pricing
|
||||||
|
|
||||||
|
When using market orders, prices should be configured to use the "correct" side of the orderbook to allow realistic pricing detection.
|
||||||
|
Assuming both buy and sell are using market orders, a configuration similar to the following might be used
|
||||||
|
|
||||||
|
``` jsonc
|
||||||
|
"order_types": {
|
||||||
|
"buy": "market",
|
||||||
|
"sell": "market"
|
||||||
|
// ...
|
||||||
|
},
|
||||||
|
"bid_strategy": {
|
||||||
|
"price_side": "ask",
|
||||||
|
// ...
|
||||||
|
},
|
||||||
|
"ask_strategy":{
|
||||||
|
"price_side": "bid",
|
||||||
|
// ...
|
||||||
|
},
|
||||||
|
```
|
||||||
|
|
||||||
|
Obviously, if only one side is using limit orders, different pricing combinations can be used.
|
@ -391,7 +391,7 @@ $ freqtrade list-markets --exchange kraken --all
|
|||||||
|
|
||||||
## Test pairlist
|
## Test pairlist
|
||||||
|
|
||||||
Use the `test-pairlist` subcommand to test the configuration of [dynamic pairlists](configuration.md#pairlists).
|
Use the `test-pairlist` subcommand to test the configuration of [dynamic pairlists](plugins.md#pairlists).
|
||||||
|
|
||||||
Requires a configuration with specified `pairlists` attribute.
|
Requires a configuration with specified `pairlists` attribute.
|
||||||
Can be used to generate static pairlists to be used during backtesting / hyperopt.
|
Can be used to generate static pairlists to be used during backtesting / hyperopt.
|
||||||
@ -415,7 +415,7 @@ optional arguments:
|
|||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
Show whitelist when using a [dynamic pairlist](configuration.md#pairlists).
|
Show whitelist when using a [dynamic pairlist](plugins.md#pairlists).
|
||||||
|
|
||||||
```
|
```
|
||||||
freqtrade test-pairlist --config config.json --quote USDT BTC
|
freqtrade test-pairlist --config config.json --quote USDT BTC
|
||||||
|
19
mkdocs.yml
19
mkdocs.yml
@ -8,6 +8,7 @@ nav:
|
|||||||
- Freqtrade Basics: bot-basics.md
|
- Freqtrade Basics: bot-basics.md
|
||||||
- Configuration: configuration.md
|
- Configuration: configuration.md
|
||||||
- Strategy Customization: strategy-customization.md
|
- Strategy Customization: strategy-customization.md
|
||||||
|
- Plugins: plugins.md
|
||||||
- Stoploss: stoploss.md
|
- Stoploss: stoploss.md
|
||||||
- Start the bot: bot-usage.md
|
- Start the bot: bot-usage.md
|
||||||
- Control the bot:
|
- Control the bot:
|
||||||
@ -17,20 +18,20 @@ nav:
|
|||||||
- Data Downloading: data-download.md
|
- Data Downloading: data-download.md
|
||||||
- Backtesting: backtesting.md
|
- Backtesting: backtesting.md
|
||||||
- Hyperopt: hyperopt.md
|
- Hyperopt: hyperopt.md
|
||||||
- Edge Positioning: edge.md
|
- Utility Sub-commands: utils.md
|
||||||
- Plugins: plugins.md
|
|
||||||
- Utility Subcommands: utils.md
|
|
||||||
- FAQ: faq.md
|
|
||||||
- Data Analysis:
|
- Data Analysis:
|
||||||
- Jupyter Notebooks: data-analysis.md
|
- Jupyter Notebooks: data-analysis.md
|
||||||
- Strategy analysis: strategy_analysis_example.md
|
- Strategy analysis: strategy_analysis_example.md
|
||||||
- Plotting: plotting.md
|
- Plotting: plotting.md
|
||||||
- SQL Cheatsheet: sql_cheatsheet.md
|
|
||||||
- Exchange-specific Notes: exchanges.md
|
- Exchange-specific Notes: exchanges.md
|
||||||
- Advanced Post-installation Tasks: advanced-setup.md
|
- Advanced Topics:
|
||||||
- Advanced Strategy: strategy-advanced.md
|
- Advanced Post-installation Tasks: advanced-setup.md
|
||||||
- Advanced Hyperopt: advanced-hyperopt.md
|
- Edge Positioning: edge.md
|
||||||
- Sandbox Testing: sandbox-testing.md
|
- Advanced Strategy: strategy-advanced.md
|
||||||
|
- Advanced Hyperopt: advanced-hyperopt.md
|
||||||
|
- Sandbox Testing: sandbox-testing.md
|
||||||
|
- FAQ: faq.md
|
||||||
|
- SQL Cheat-sheet: sql_cheatsheet.md
|
||||||
- Updating Freqtrade: updating.md
|
- Updating Freqtrade: updating.md
|
||||||
- Deprecated Features: deprecated.md
|
- Deprecated Features: deprecated.md
|
||||||
- Contributors Guide: developer.md
|
- Contributors Guide: developer.md
|
||||||
|
Loading…
Reference in New Issue
Block a user