Updated based on feedback:

- Profit commands now use float
- Compatible with --best
- Corrected wrong information in docs
This commit is contained in:
Fredrik Rydin 2020-02-10 20:54:31 +01:00
parent 5bf4c5869b
commit c924e4d519
3 changed files with 140 additions and 70 deletions

View File

@ -36,6 +36,38 @@ optional arguments:
└── sample_strategy.py └── sample_strategy.py
``` ```
## Create new config
Creates a new configuration file, asking some questions which are important selections for a configuration.
```
usage: freqtrade new-config [-h] [-c PATH]
optional arguments:
-h, --help show this help message and exit
-c PATH, --config PATH
Specify configuration file (default: `config.json`). Multiple --config options may be used. Can be set to `-`
to read config from stdin.
```
!!! Warning
Only vital questions are asked. Freqtrade offers a lot more configuration possibilities, which are listed in the [Configuration documentation](configuration.md#configuration-parameters)
### Create config examples
```
$ freqtrade new-config --config config_binance.json
? Do you want to enable Dry-run (simulated trades)? Yes
? Please insert your stake currency: BTC
? Please insert your stake amount: 0.05
? Please insert max_open_trades (Integer or 'unlimited'): 5
? Please insert your ticker interval: 15m
? Please insert your display Currency (for reporting): USD
? Select exchange binance
? Do you want to enable Telegram? No
```
## Create new strategy ## Create new strategy
Creates a new strategy from a template similar to SampleStrategy. Creates a new strategy from a template similar to SampleStrategy.
@ -135,27 +167,15 @@ Common arguments:
``` ```
``` ```
freqtrade list-hyperopts --help freqtrade list-hyperopts --help
usage: freqtrade hyperopt-list [-h] [-v] [--logfile FILE] [-V] [-c PATH] usage: freqtrade list-hyperopts [-h] [-v] [--logfile FILE] [-V] [-c PATH]
[-d PATH] [--userdir PATH] [--best] [-d PATH] [--userdir PATH]
[--profitable] [--min-avg-time INT] [--hyperopt-path PATH] [-1]
[--max-avg-time INT] [--min-avg-profit FLOAT]
[--min-total-profit FLOAT] [--no-color]
[--print-json] [--no-details]
optional arguments: optional arguments:
-h, --help show this help message and exit -h, --help show this help message and exit
--best Select only best epochs. --hyperopt-path PATH Specify additional lookup path for Hyperopt and
--profitable Select only profitable epochs. Hyperopt Loss functions.
--min-avg-time INT Select epochs on above average time. -1, --one-column Print output in one column.
--max-avg-time INT Select epochs on under average time.
--min-avg-profit FLOAT
Select epochs on above average profit.
--min-total-profit FLOAT
Select epochs on above total profit.
--no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file.
--print-json Print best result detailization in JSON format.
--no-details Do not print best epoch details.
Common arguments: Common arguments:
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages). -v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
@ -232,20 +252,31 @@ All exchanges supported by the ccxt library: _1btcxe, acx, adara, allcoin, anxpr
Use the `list-timeframes` subcommand to see the list of ticker intervals (timeframes) available for the exchange. Use the `list-timeframes` subcommand to see the list of ticker intervals (timeframes) available for the exchange.
``` ```
usage: freqtrade list-timeframes [-h] [--exchange EXCHANGE] [-1] usage: freqtrade list-timeframes [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH] [--userdir PATH] [--exchange EXCHANGE] [-1]
optional arguments: optional arguments:
-h, --help show this help message and exit -h, --help show this help message and exit
--exchange EXCHANGE Exchange name (default: `bittrex`). Only valid if no --exchange EXCHANGE Exchange name (default: `bittrex`). Only valid if no config is provided.
config is provided. -1, --one-column Print output in one column.
-1, --one-column Print output in one column.
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: `config.json`). 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.
``` ```
* Example: see the timeframes for the 'binance' exchange, set in the configuration file: * Example: see the timeframes for the 'binance' exchange, set in the configuration file:
``` ```
$ freqtrade -c config_binance.json list-timeframes $ freqtrade list-timeframes -c config_binance.json
... ...
Timeframes available for the exchange `binance`: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M Timeframes available for the exchange `binance`: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M
``` ```
@ -269,14 +300,16 @@ You can print info about any pair/market with these subcommands - and you can fi
These subcommands have same usage and same set of available options: These subcommands have same usage and same set of available options:
``` ```
usage: freqtrade list-markets [-h] [--exchange EXCHANGE] [--print-list] usage: freqtrade list-markets [-h] [-v] [--logfile FILE] [-V] [-c PATH]
[--print-json] [-1] [--print-csv] [-d PATH] [--userdir PATH] [--exchange EXCHANGE]
[--print-list] [--print-json] [-1] [--print-csv]
[--base BASE_CURRENCY [BASE_CURRENCY ...]] [--base BASE_CURRENCY [BASE_CURRENCY ...]]
[--quote QUOTE_CURRENCY [QUOTE_CURRENCY ...]] [--quote QUOTE_CURRENCY [QUOTE_CURRENCY ...]]
[-a] [-a]
usage: freqtrade list-pairs [-h] [--exchange EXCHANGE] [--print-list] usage: freqtrade list-pairs [-h] [-v] [--logfile FILE] [-V] [-c PATH]
[--print-json] [-1] [--print-csv] [-d PATH] [--userdir PATH] [--exchange EXCHANGE]
[--print-list] [--print-json] [-1] [--print-csv]
[--base BASE_CURRENCY [BASE_CURRENCY ...]] [--base BASE_CURRENCY [BASE_CURRENCY ...]]
[--quote QUOTE_CURRENCY [QUOTE_CURRENCY ...]] [-a] [--quote QUOTE_CURRENCY [QUOTE_CURRENCY ...]] [-a]
@ -295,6 +328,22 @@ optional arguments:
Specify quote currency(-ies). Space-separated list. Specify quote currency(-ies). Space-separated list.
-a, --all Print all pairs or market symbols. By default only -a, --all Print all pairs or market symbols. By default only
active ones are shown. active ones are shown.
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: `config.json`).
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.
``` ```
By default, only active pairs/markets are shown. Active pairs/markets are those that can currently be traded By default, only active pairs/markets are shown. Active pairs/markets are those that can currently be traded
@ -316,7 +365,7 @@ $ freqtrade list-pairs --quote USD --print-json
human-readable list with summary: human-readable list with summary:
``` ```
$ freqtrade -c config_binance.json list-pairs --all --base BTC ETH --quote USDT USD --print-list $ freqtrade list-pairs -c config_binance.json --all --base BTC ETH --quote USDT USD --print-list
``` ```
* Print all markets on exchange "Kraken", in the tabular format: * Print all markets on exchange "Kraken", in the tabular format:
@ -364,17 +413,40 @@ You can list the hyperoptimization epochs the Hyperopt module evaluated previous
``` ```
usage: freqtrade hyperopt-list [-h] [-v] [--logfile FILE] [-V] [-c PATH] usage: freqtrade hyperopt-list [-h] [-v] [--logfile FILE] [-V] [-c PATH]
[-d PATH] [--userdir PATH] [--best] [-d PATH] [--userdir PATH] [--best]
[--profitable] [--no-color] [--print-json] [--profitable] [--min-avg-time FLOAT]
[--no-details] [--max-avg-time FLOAT] [--min-avg-profit FLOAT]
[--min-total-profit FLOAT] [--no-color]
[--print-json] [--no-details]
optional arguments: optional arguments:
-h, --help show this help message and exit -h, --help show this help message and exit
--best Select only best epochs. --best Select only best epochs.
--profitable Select only profitable epochs. --profitable Select only profitable epochs.
--min-avg-time FLOAT Select epochs on above average time.
--max-avg-time FLOAT Select epochs on under average time.
--min-avg-profit FLOAT
Select epochs on above average profit.
--min-total-profit FLOAT
Select epochs on above total profit.
--no-color Disable colorization of hyperopt results. May be --no-color Disable colorization of hyperopt results. May be
useful if you are redirecting output to a file. useful if you are redirecting output to a file.
--print-json Print best result detailization in JSON format. --print-json Print best result detailization in JSON format.
--no-details Do not print best epoch details. --no-details Do not print best epoch details.
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: `config.json`).
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.
``` ```
### Examples ### Examples

View File

@ -401,14 +401,14 @@ AVAILABLE_CLI_OPTIONS = {
"hyperopt_list_min_avg_time": Arg( "hyperopt_list_min_avg_time": Arg(
'--min-avg-time', '--min-avg-time',
help='Select epochs on above average time.', help='Select epochs on above average time.',
type=check_int_nonzero, type=float,
metavar='INT', metavar='FLOAT',
), ),
"hyperopt_list_max_avg_time": Arg( "hyperopt_list_max_avg_time": Arg(
'--max-avg-time', '--max-avg-time',
help='Select epochs on under average time.', help='Select epochs on under average time.',
type=check_int_nonzero, type=float,
metavar='INT', metavar='FLOAT',
), ),
"hyperopt_list_min_avg_profit": Arg( "hyperopt_list_min_avg_profit": Arg(
'--min-avg-profit', '--min-avg-profit',

View File

@ -27,10 +27,10 @@ def start_hyperopt_list(args: Dict[str, Any]) -> None:
filteroptions = { filteroptions = {
'only_best': config.get('hyperopt_list_best', False), 'only_best': config.get('hyperopt_list_best', False),
'only_profitable': config.get('hyperopt_list_profitable', False), 'only_profitable': config.get('hyperopt_list_profitable', False),
'filter_min_avg_time': config.get('hyperopt_list_min_avg_time', 0), 'filter_min_avg_time': config.get('hyperopt_list_min_avg_time', None),
'filter_max_avg_time': config.get('hyperopt_list_max_avg_time', 0), 'filter_max_avg_time': config.get('hyperopt_list_max_avg_time', None),
'filter_min_avg_profit': config.get('hyperopt_list_min_avg_profit', 0.0), 'filter_min_avg_profit': config.get('hyperopt_list_min_avg_profit', None),
'filter_min_total_profit': config.get('hyperopt_list_min_total_profit', 0.0) 'filter_min_total_profit': config.get('hyperopt_list_min_total_profit', None)
} }
trials_file = (config['user_data_dir'] / trials_file = (config['user_data_dir'] /
@ -74,10 +74,10 @@ def start_hyperopt_show(args: Dict[str, Any]) -> None:
filteroptions = { filteroptions = {
'only_best': config.get('hyperopt_list_best', False), 'only_best': config.get('hyperopt_list_best', False),
'only_profitable': config.get('hyperopt_list_profitable', False), 'only_profitable': config.get('hyperopt_list_profitable', False),
'filter_min_avg_time': config.get('hyperopt_list_min_avg_time', 0), 'filter_min_avg_time': config.get('hyperopt_list_min_avg_time', None),
'filter_max_avg_time': config.get('hyperopt_list_max_avg_time', 0), 'filter_max_avg_time': config.get('hyperopt_list_max_avg_time', None),
'filter_min_avg_profit': config.get('hyperopt_list_min_avg_profit', 0), 'filter_min_avg_profit': config.get('hyperopt_list_min_avg_profit', None),
'filter_min_total_profit': config.get('hyperopt_list_min_total_profit', 0) 'filter_min_total_profit': config.get('hyperopt_list_min_total_profit', None)
} }
no_header = config.get('hyperopt_show_no_header', False) no_header = config.get('hyperopt_show_no_header', False)
@ -119,33 +119,31 @@ def _hyperopt_filter_trials(trials: List, filteroptions: dict) -> List:
trials = [x for x in trials if x['is_best']] trials = [x for x in trials if x['is_best']]
if filteroptions['only_profitable']: if filteroptions['only_profitable']:
trials = [x for x in trials if x['results_metrics']['profit'] > 0] trials = [x for x in trials if x['results_metrics']['profit'] > 0]
if filteroptions['filter_min_avg_time'] is not None:
if not filteroptions['only_best']: trials = [x for x in trials if x['results_metrics']['trade_count'] > 0]
if filteroptions['filter_min_avg_time'] > 0: trials = [
trials = [x for x in trials if x['results_metrics']['trade_count'] > 0] x for x in trials
trials = [ if x['results_metrics']['duration'] > filteroptions['filter_min_avg_time']
x for x in trials ]
if x['results_metrics']['duration'] > filteroptions['filter_min_avg_time'] if filteroptions['filter_max_avg_time'] is not None:
] trials = [x for x in trials if x['results_metrics']['trade_count'] > 0]
if filteroptions['filter_max_avg_time'] > 0: trials = [
trials = [x for x in trials if x['results_metrics']['trade_count'] > 0] x for x in trials
trials = [ if x['results_metrics']['duration'] < filteroptions['filter_max_avg_time']
x for x in trials ]
if x['results_metrics']['duration'] < filteroptions['filter_max_avg_time'] if filteroptions['filter_min_avg_profit'] is not None:
] trials = [x for x in trials if x['results_metrics']['trade_count'] > 0]
if filteroptions['filter_min_avg_profit'] > 0: trials = [
trials = [x for x in trials if x['results_metrics']['trade_count'] > 0] x for x in trials
trials = [ if x['results_metrics']['avg_profit']
x for x in trials > filteroptions['filter_min_avg_profit']
if x['results_metrics']['avg_profit'] ]
> filteroptions['filter_min_avg_profit'] if filteroptions['filter_min_total_profit'] is not None:
] trials = [x for x in trials if x['results_metrics']['trade_count'] > 0]
if filteroptions['filter_min_total_profit'] > 0: trials = [
trials = [x for x in trials if x['results_metrics']['trade_count'] > 0] x for x in trials
trials = [ if x['results_metrics']['profit'] > filteroptions['filter_min_total_profit']
x for x in trials ]
if x['results_metrics']['profit'] > filteroptions['filter_min_total_profit']
]
logger.info(f"{len(trials)} " + logger.info(f"{len(trials)} " +
("best " if filteroptions['only_best'] else "") + ("best " if filteroptions['only_best'] else "") +