Merge pull request #1615 from freqtrade/fix/hyperopt_peram
Update documentation for --customhyperopt
This commit is contained in:
commit
6d63b8e71e
39
README.md
39
README.md
@ -68,39 +68,38 @@ For any other type of installation please refer to [Installation doc](https://ww
|
|||||||
### Bot commands
|
### Bot commands
|
||||||
|
|
||||||
```
|
```
|
||||||
usage: main.py [-h] [-v] [--version] [-c PATH] [-d PATH] [-s NAME]
|
usage: freqtrade [-h] [-v] [--version] [-c PATH] [-d PATH] [-s NAME]
|
||||||
[--strategy-path PATH] [--customhyperopt NAME]
|
[--strategy-path PATH] [--dynamic-whitelist [INT]]
|
||||||
[--dynamic-whitelist [INT]] [--db-url PATH]
|
[--db-url PATH]
|
||||||
{backtesting,edge,hyperopt} ...
|
{backtesting,edge,hyperopt} ...
|
||||||
|
|
||||||
Free, open source crypto trading bot
|
Free, open source crypto trading bot
|
||||||
|
|
||||||
positional arguments:
|
positional arguments:
|
||||||
{backtesting,edge,hyperopt}
|
{backtesting,edge,hyperopt}
|
||||||
backtesting backtesting module
|
backtesting Backtesting module.
|
||||||
edge edge module
|
edge Edge module.
|
||||||
hyperopt hyperopt module
|
hyperopt Hyperopt module.
|
||||||
|
|
||||||
optional arguments:
|
optional arguments:
|
||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
-v, --verbose verbose mode (-vv for more, -vvv to get all messages)
|
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
||||||
--version show program\'s version number and exit
|
--version show program's version number and exit
|
||||||
-c PATH, --config PATH
|
-c PATH, --config PATH
|
||||||
specify configuration file (default: config.json)
|
Specify configuration file (default: None). Multiple
|
||||||
|
--config options may be used.
|
||||||
-d PATH, --datadir PATH
|
-d PATH, --datadir PATH
|
||||||
path to backtest data
|
Path to backtest data.
|
||||||
-s NAME, --strategy NAME
|
-s NAME, --strategy NAME
|
||||||
specify strategy class name (default: DefaultStrategy)
|
Specify strategy class name (default:
|
||||||
--strategy-path PATH specify additional strategy lookup path
|
DefaultStrategy).
|
||||||
--customhyperopt NAME
|
--strategy-path PATH Specify additional strategy lookup path.
|
||||||
specify hyperopt class name (default:
|
|
||||||
DefaultHyperOpts)
|
|
||||||
--dynamic-whitelist [INT]
|
--dynamic-whitelist [INT]
|
||||||
dynamically generate and update whitelist based on 24h
|
Dynamically generate and update whitelist based on 24h
|
||||||
BaseVolume (default: 20) DEPRECATED.
|
BaseVolume (default: 20). DEPRECATED.
|
||||||
--db-url PATH Override trades database URL, this is useful if
|
--db-url PATH Override trades database URL, this is useful if
|
||||||
dry_run is enabled or in custom deployments (default:
|
dry_run is enabled or in custom deployments (default:
|
||||||
None)
|
None).
|
||||||
```
|
```
|
||||||
|
|
||||||
### Telegram RPC commands
|
### Telegram RPC commands
|
||||||
@ -195,4 +194,4 @@ To run this bot we recommend you a cloud instance with a minimum of:
|
|||||||
- [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
|
- [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
|
||||||
- [TA-Lib](https://mrjbq7.github.io/ta-lib/install.html)
|
- [TA-Lib](https://mrjbq7.github.io/ta-lib/install.html)
|
||||||
- [virtualenv](https://virtualenv.pypa.io/en/stable/installation/) (Recommended)
|
- [virtualenv](https://virtualenv.pypa.io/en/stable/installation/) (Recommended)
|
||||||
- [Docker](https://www.docker.com/products/docker) (Recommended)
|
- [Docker](https://www.docker.com/products/docker) (Recommended)
|
||||||
|
@ -6,39 +6,39 @@ This page explains the different parameters of the bot and how to run it.
|
|||||||
## Bot commands
|
## Bot commands
|
||||||
|
|
||||||
```
|
```
|
||||||
usage: main.py [-h] [-v] [--version] [-c PATH] [-d PATH] [-s NAME]
|
usage: freqtrade [-h] [-v] [--version] [-c PATH] [-d PATH] [-s NAME]
|
||||||
[--strategy-path PATH] [--customhyperopt NAME]
|
[--strategy-path PATH] [--dynamic-whitelist [INT]]
|
||||||
[--dynamic-whitelist [INT]] [--db-url PATH]
|
[--db-url PATH]
|
||||||
{backtesting,edge,hyperopt} ...
|
{backtesting,edge,hyperopt} ...
|
||||||
|
|
||||||
Free, open source crypto trading bot
|
Free, open source crypto trading bot
|
||||||
|
|
||||||
positional arguments:
|
positional arguments:
|
||||||
{backtesting,edge,hyperopt}
|
{backtesting,edge,hyperopt}
|
||||||
backtesting backtesting module
|
backtesting Backtesting module.
|
||||||
edge edge module
|
edge Edge module.
|
||||||
hyperopt hyperopt module
|
hyperopt Hyperopt module.
|
||||||
|
|
||||||
optional arguments:
|
optional arguments:
|
||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
-v, --verbose verbose mode (-vv for more, -vvv to get all messages)
|
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
|
||||||
--version show program\'s version number and exit
|
--version show program's version number and exit
|
||||||
-c PATH, --config PATH
|
-c PATH, --config PATH
|
||||||
specify configuration file (default: config.json)
|
Specify configuration file (default: None). Multiple
|
||||||
|
--config options may be used.
|
||||||
-d PATH, --datadir PATH
|
-d PATH, --datadir PATH
|
||||||
path to backtest data
|
Path to backtest data.
|
||||||
-s NAME, --strategy NAME
|
-s NAME, --strategy NAME
|
||||||
specify strategy class name (default: DefaultStrategy)
|
Specify strategy class name (default:
|
||||||
--strategy-path PATH specify additional strategy lookup path
|
DefaultStrategy).
|
||||||
--customhyperopt NAME
|
--strategy-path PATH Specify additional strategy lookup path.
|
||||||
specify hyperopt class name (default:
|
|
||||||
DefaultHyperOpts)
|
|
||||||
--dynamic-whitelist [INT]
|
--dynamic-whitelist [INT]
|
||||||
dynamically generate and update whitelist based on 24h
|
Dynamically generate and update whitelist based on 24h
|
||||||
BaseVolume (default: 20) DEPRECATED.
|
BaseVolume (default: 20). DEPRECATED.
|
||||||
--db-url PATH Override trades database URL, this is useful if
|
--db-url PATH Override trades database URL, this is useful if
|
||||||
dry_run is enabled or in custom deployments (default:
|
dry_run is enabled or in custom deployments (default:
|
||||||
None)
|
None).
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### How to use a different configuration file?
|
### How to use a different configuration file?
|
||||||
@ -159,27 +159,27 @@ python3 ./freqtrade/main.py -c config.json --db-url sqlite:///tradesv3.dry_run.s
|
|||||||
Backtesting also uses the config specified via `-c/--config`.
|
Backtesting also uses the config specified via `-c/--config`.
|
||||||
|
|
||||||
```
|
```
|
||||||
usage: main.py backtesting [-h] [-i TICKER_INTERVAL] [--timerange TIMERANGE]
|
usage: freqtrade backtesting [-h] [-i TICKER_INTERVAL] [--timerange TIMERANGE]
|
||||||
[--eps] [--dmmp] [-l] [-r]
|
[--eps] [--dmmp] [-l] [-r]
|
||||||
[--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]]
|
[--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]]
|
||||||
[--export EXPORT] [--export-filename PATH]
|
[--export EXPORT] [--export-filename PATH]
|
||||||
|
|
||||||
optional arguments:
|
optional arguments:
|
||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
-i TICKER_INTERVAL, --ticker-interval TICKER_INTERVAL
|
-i TICKER_INTERVAL, --ticker-interval TICKER_INTERVAL
|
||||||
specify ticker interval (1m, 5m, 30m, 1h, 1d)
|
Specify ticker interval (1m, 5m, 30m, 1h, 1d).
|
||||||
--timerange TIMERANGE
|
--timerange TIMERANGE
|
||||||
specify what timerange of data to use.
|
Specify what timerange of data to use.
|
||||||
--eps, --enable-position-stacking
|
--eps, --enable-position-stacking
|
||||||
Allow buying the same pair multiple times (position
|
Allow buying the same pair multiple times (position
|
||||||
stacking)
|
stacking).
|
||||||
--dmmp, --disable-max-market-positions
|
--dmmp, --disable-max-market-positions
|
||||||
Disable applying `max_open_trades` during backtest
|
Disable applying `max_open_trades` during backtest
|
||||||
(same as setting `max_open_trades` to a very high
|
(same as setting `max_open_trades` to a very high
|
||||||
number)
|
number).
|
||||||
-l, --live using live data
|
-l, --live Use live data.
|
||||||
-r, --refresh-pairs-cached
|
-r, --refresh-pairs-cached
|
||||||
refresh the pairs files in tests/testdata with the
|
Refresh the pairs files in tests/testdata with the
|
||||||
latest data from the exchange. Use it if you want to
|
latest data from the exchange. Use it if you want to
|
||||||
run your backtesting with up-to-date data.
|
run your backtesting with up-to-date data.
|
||||||
--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]
|
--strategy-list STRATEGY_LIST [STRATEGY_LIST ...]
|
||||||
@ -189,7 +189,7 @@ optional arguments:
|
|||||||
this together with --export trades, the strategy-name
|
this together with --export trades, the strategy-name
|
||||||
is injected into the filename (so backtest-data.json
|
is injected into the filename (so backtest-data.json
|
||||||
becomes backtest-data-DefaultStrategy.json
|
becomes backtest-data-DefaultStrategy.json
|
||||||
--export EXPORT export backtest results, argument are: trades Example
|
--export EXPORT Export backtest results, argument are: trades. Example
|
||||||
--export=trades
|
--export=trades
|
||||||
--export-filename PATH
|
--export-filename PATH
|
||||||
Save backtest results to this filename requires
|
Save backtest results to this filename requires
|
||||||
@ -219,29 +219,30 @@ To optimize your strategy, you can use hyperopt parameter hyperoptimization
|
|||||||
to find optimal parameter values for your stategy.
|
to find optimal parameter values for your stategy.
|
||||||
|
|
||||||
```
|
```
|
||||||
usage: freqtrade hyperopt [-h] [-i TICKER_INTERVAL] [--eps] [--dmmp]
|
usage: freqtrade hyperopt [-h] [-i TICKER_INTERVAL] [--timerange TIMERANGE]
|
||||||
[--timerange TIMERANGE] [-e INT]
|
[--customhyperopt NAME] [--eps] [--dmmp] [-e INT]
|
||||||
[-s {all,buy,roi,stoploss} [{all,buy,roi,stoploss} ...]]
|
[-s {all,buy,sell,roi,stoploss} [{all,buy,sell,roi,stoploss} ...]]
|
||||||
|
|
||||||
optional arguments:
|
optional arguments:
|
||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
-i TICKER_INTERVAL, --ticker-interval TICKER_INTERVAL
|
-i TICKER_INTERVAL, --ticker-interval TICKER_INTERVAL
|
||||||
specify ticker interval (1m, 5m, 30m, 1h, 1d)
|
Specify ticker interval (1m, 5m, 30m, 1h, 1d).
|
||||||
|
--timerange TIMERANGE
|
||||||
|
Specify what timerange of data to use.
|
||||||
|
--customhyperopt NAME
|
||||||
|
Specify hyperopt class name (default:
|
||||||
|
DefaultHyperOpts).
|
||||||
--eps, --enable-position-stacking
|
--eps, --enable-position-stacking
|
||||||
Allow buying the same pair multiple times (position
|
Allow buying the same pair multiple times (position
|
||||||
stacking)
|
stacking).
|
||||||
--dmmp, --disable-max-market-positions
|
--dmmp, --disable-max-market-positions
|
||||||
Disable applying `max_open_trades` during backtest
|
Disable applying `max_open_trades` during backtest
|
||||||
(same as setting `max_open_trades` to a very high
|
(same as setting `max_open_trades` to a very high
|
||||||
number)
|
number).
|
||||||
--timerange TIMERANGE
|
-e INT, --epochs INT Specify number of epochs (default: 100).
|
||||||
specify what timerange of data to use.
|
-s {all,buy,sell,roi,stoploss} [{all,buy,sell,roi,stoploss} ...], --spaces {all,buy,sell,roi,stoploss} [{all,buy,sell,roi,stoploss} ...]
|
||||||
--hyperopt PATH specify hyperopt file (default:
|
|
||||||
freqtrade/optimize/default_hyperopt.py)
|
|
||||||
-e INT, --epochs INT specify number of epochs (default: 100)
|
|
||||||
-s {all,buy,roi,stoploss} [{all,buy,roi,stoploss} ...], --spaces {all,buy,roi,stoploss} [{all,buy,roi,stoploss} ...]
|
|
||||||
Specify which parameters to hyperopt. Space separate
|
Specify which parameters to hyperopt. Space separate
|
||||||
list. Default: all
|
list. Default: all.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -250,22 +251,22 @@ optional arguments:
|
|||||||
To know your trade expectacny and winrate against historical data, you can use Edge.
|
To know your trade expectacny and winrate against historical data, you can use Edge.
|
||||||
|
|
||||||
```
|
```
|
||||||
usage: main.py edge [-h] [-i TICKER_INTERVAL] [--timerange TIMERANGE] [-r]
|
usage: freqtrade edge [-h] [-i TICKER_INTERVAL] [--timerange TIMERANGE] [-r]
|
||||||
[--stoplosses STOPLOSS_RANGE]
|
[--stoplosses STOPLOSS_RANGE]
|
||||||
|
|
||||||
optional arguments:
|
optional arguments:
|
||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
-i TICKER_INTERVAL, --ticker-interval TICKER_INTERVAL
|
-i TICKER_INTERVAL, --ticker-interval TICKER_INTERVAL
|
||||||
specify ticker interval (1m, 5m, 30m, 1h, 1d)
|
Specify ticker interval (1m, 5m, 30m, 1h, 1d).
|
||||||
--timerange TIMERANGE
|
--timerange TIMERANGE
|
||||||
specify what timerange of data to use.
|
Specify what timerange of data to use.
|
||||||
-r, --refresh-pairs-cached
|
-r, --refresh-pairs-cached
|
||||||
refresh the pairs files in tests/testdata with the
|
Refresh the pairs files in tests/testdata with the
|
||||||
latest data from the exchange. Use it if you want to
|
latest data from the exchange. Use it if you want to
|
||||||
run your edge with up-to-date data.
|
run your edge with up-to-date data.
|
||||||
--stoplosses STOPLOSS_RANGE
|
--stoplosses STOPLOSS_RANGE
|
||||||
defines a range of stoploss against which edge will
|
Defines a range of stoploss against which edge will
|
||||||
assess the strategythe format is "min,max,step"
|
assess the strategy the format is "min,max,step"
|
||||||
(without any space).example:
|
(without any space).example:
|
||||||
--stoplosses=-0.01,-0.1,-0.001
|
--stoplosses=-0.01,-0.1,-0.001
|
||||||
```
|
```
|
||||||
|
@ -152,7 +152,7 @@ Because hyperopt tries a lot of combinations to find the best parameters it will
|
|||||||
We strongly recommend to use `screen` or `tmux` to prevent any connection loss.
|
We strongly recommend to use `screen` or `tmux` to prevent any connection loss.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 ./freqtrade/main.py --hyperopt <hyperoptname> -c config.json hyperopt -e 5000 --spaces all
|
python3 ./freqtrade/main.py -c config.json hyperopt --customhyperopt <hyperoptname> -e 5000 --spaces all
|
||||||
```
|
```
|
||||||
|
|
||||||
Use `<hyperoptname>` as the name of the custom hyperopt used.
|
Use `<hyperoptname>` as the name of the custom hyperopt used.
|
||||||
@ -285,8 +285,13 @@ This would translate to the following ROI table:
|
|||||||
### Validate backtest result
|
### Validate backtest result
|
||||||
|
|
||||||
Once the optimized strategy has been implemented into your strategy, you should backtest this strategy to make sure everything is working as expected.
|
Once the optimized strategy has been implemented into your strategy, you should backtest this strategy to make sure everything is working as expected.
|
||||||
To archive the same results (number of trades, ...) than during hyperopt, please use the command line flag `--disable-max-market-positions`.
|
To archive the same results (number of trades, ...) than during hyperopt, please use the command line flags `--disable-max-market-positions` and `--enable-position-stacking` for backtesting.
|
||||||
This setting is the default for hyperopt for speed reasons. You can overwrite this in the configuration by setting `"position_stacking"=false` or by changing the relevant line in your hyperopt file [here](https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/optimize/hyperopt.py#L283).
|
|
||||||
|
This configuration is the default in hyperopt for performance reasons.
|
||||||
|
|
||||||
|
You can overwrite position stacking in the configuration by explicitly setting `"position_stacking"=false` or by changing the relevant line in your hyperopt file [here](https://github.com/freqtrade/freqtrade/blob/develop/freqtrade/optimize/hyperopt.py#L191).
|
||||||
|
|
||||||
|
Enabling the market-position for hyperopt is currently not possible.
|
||||||
|
|
||||||
!!! Note:
|
!!! Note:
|
||||||
Dry/live runs will **NOT** use position stacking - therefore it does make sense to also validate the strategy without this as it's closer to reality.
|
Dry/live runs will **NOT** use position stacking - therefore it does make sense to also validate the strategy without this as it's closer to reality.
|
||||||
|
@ -108,14 +108,6 @@ class Arguments(object):
|
|||||||
type=str,
|
type=str,
|
||||||
metavar='PATH',
|
metavar='PATH',
|
||||||
)
|
)
|
||||||
self.parser.add_argument(
|
|
||||||
'--customhyperopt',
|
|
||||||
help='Specify hyperopt class name (default: %(default)s).',
|
|
||||||
dest='hyperopt',
|
|
||||||
default=constants.DEFAULT_HYPEROPT,
|
|
||||||
type=str,
|
|
||||||
metavar='NAME',
|
|
||||||
)
|
|
||||||
self.parser.add_argument(
|
self.parser.add_argument(
|
||||||
'--dynamic-whitelist',
|
'--dynamic-whitelist',
|
||||||
help='Dynamically generate and update whitelist'
|
help='Dynamically generate and update whitelist'
|
||||||
@ -248,6 +240,14 @@ class Arguments(object):
|
|||||||
"""
|
"""
|
||||||
Parses given arguments for Hyperopt scripts.
|
Parses given arguments for Hyperopt scripts.
|
||||||
"""
|
"""
|
||||||
|
parser.add_argument(
|
||||||
|
'--customhyperopt',
|
||||||
|
help='Specify hyperopt class name (default: %(default)s).',
|
||||||
|
dest='hyperopt',
|
||||||
|
default=constants.DEFAULT_HYPEROPT,
|
||||||
|
type=str,
|
||||||
|
metavar='NAME',
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--eps', '--enable-position-stacking',
|
'--eps', '--enable-position-stacking',
|
||||||
help='Allow buying the same pair multiple times (position stacking).',
|
help='Allow buying the same pair multiple times (position stacking).',
|
||||||
|
@ -67,9 +67,6 @@ class Configuration(object):
|
|||||||
if self.args.strategy_path:
|
if self.args.strategy_path:
|
||||||
config.update({'strategy_path': self.args.strategy_path})
|
config.update({'strategy_path': self.args.strategy_path})
|
||||||
|
|
||||||
# Add the hyperopt file to use
|
|
||||||
config.update({'hyperopt': self.args.hyperopt})
|
|
||||||
|
|
||||||
# Load Common configuration
|
# Load Common configuration
|
||||||
config = self._load_common_config(config)
|
config = self._load_common_config(config)
|
||||||
|
|
||||||
@ -276,6 +273,11 @@ class Configuration(object):
|
|||||||
Extract information for sys.argv and load Hyperopt configuration
|
Extract information for sys.argv and load Hyperopt configuration
|
||||||
:return: configuration as dictionary
|
:return: configuration as dictionary
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if "hyperopt" in self.args:
|
||||||
|
# Add the hyperopt file to use
|
||||||
|
config.update({'hyperopt': self.args.hyperopt})
|
||||||
|
|
||||||
# If --epochs is used we add it to the configuration
|
# If --epochs is used we add it to the configuration
|
||||||
if 'epochs' in self.args and self.args.epochs:
|
if 'epochs' in self.args and self.args.epochs:
|
||||||
config.update({'epochs': self.args.epochs})
|
config.update({'epochs': self.args.epochs})
|
||||||
|
Loading…
Reference in New Issue
Block a user