2019-09-30 18:36:52 +00:00
# Utility Subcommands
Besides the Live-Trade and Dry-Run run modes, the `backtesting` , `edge` and `hyperopt` optimization subcommands, and the `download-data` subcommand which prepares historical data, the bot contains a number of utility subcommands. They are described in this section.
2019-11-01 14:02:42 +00:00
## Create userdir
Creates the directory structure to hold your files for freqtrade.
Will also create strategy and hyperopt examples for you to get started.
Can be used multiple times - using `--reset` will reset the sample strategy and hyperopt files to their default state.
```
usage: freqtrade create-userdir [-h] [--userdir PATH] [--reset]
optional arguments:
-h, --help show this help message and exit
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
--reset Reset sample files to their original state.
```
!!! Warning
Using `--reset` may result in loss of data, since this will overwrite all sample files without asking again.
```
├── backtest_results
├── data
├── hyperopt_results
├── hyperopts
│ ├── sample_hyperopt_advanced.py
│ ├── sample_hyperopt_loss.py
│ └── sample_hyperopt.py
├── notebooks
│ └── strategy_analysis_example.ipynb
├── plot
└── strategies
└── sample_strategy.py
```
2020-02-01 12:44:04 +00:00
## 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 )
2020-02-01 12:54:17 +00:00
### 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
```
2019-11-17 09:31:21 +00:00
## Create new strategy
Creates a new strategy from a template similar to SampleStrategy.
The file will be named inline with your class name, and will not overwrite existing files.
Results will be located in `user_data/strategies/<strategyclassname>.py` .
``` output
usage: freqtrade new-strategy [-h] [--userdir PATH] [-s NAME]
2019-11-22 12:44:50 +00:00
[--template {full,minimal}]
2019-11-17 09:31:21 +00:00
optional arguments:
-h, --help show this help message and exit
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
-s NAME, --strategy NAME
Specify strategy class name which will be used by the
bot.
2019-11-22 12:44:50 +00:00
--template {full,minimal}
Use a template which is either `minimal` or `full`
2019-11-24 08:55:34 +00:00
(containing multiple sample indicators). Default:
`full` .
2019-11-17 09:31:21 +00:00
```
2019-12-04 13:30:53 +00:00
### Sample usage of new-strategy
2019-11-17 09:31:21 +00:00
```bash
2019-12-04 13:30:53 +00:00
freqtrade new-strategy --strategy AwesomeStrategy
2019-11-17 09:31:21 +00:00
```
With custom user directory
```bash
2019-12-04 13:30:53 +00:00
freqtrade new-strategy --userdir ~/.freqtrade/ --strategy AwesomeStrategy
2019-11-17 09:31:21 +00:00
```
2019-12-04 13:30:53 +00:00
## Create new hyperopt
Creates a new hyperopt from a template similar to SampleHyperopt.
The file will be named inline with your class name, and will not overwrite existing files.
Results will be located in `user_data/hyperopts/<classname>.py` .
2019-11-17 09:31:21 +00:00
``` output
usage: freqtrade new-hyperopt [-h] [--userdir PATH] [--hyperopt NAME]
2019-11-22 12:44:50 +00:00
[--template {full,minimal}]
2019-11-17 09:31:21 +00:00
optional arguments:
-h, --help show this help message and exit
--userdir PATH, --user-data-dir PATH
Path to userdata directory.
--hyperopt NAME Specify hyperopt class name which will be used by the
bot.
2019-11-22 12:44:50 +00:00
--template {full,minimal}
Use a template which is either `minimal` or `full`
2019-11-24 08:55:34 +00:00
(containing multiple sample indicators). Default:
`full` .
2019-11-17 09:31:21 +00:00
```
2019-11-01 14:02:42 +00:00
2019-12-04 13:30:53 +00:00
### Sample usage of new-hyperopt
```bash
freqtrade new-hyperopt --hyperopt AwesomeHyperopt
```
With custom user directory
```bash
freqtrade new-hyperopt --userdir ~/.freqtrade/ --hyperopt AwesomeHyperopt
```
2020-02-02 15:56:54 +00:00
## List Strategies and List Hyperopts
2019-12-24 14:35:53 +00:00
2020-02-02 15:56:54 +00:00
Use the `list-strategies` subcommand to see all strategies in one particular directory and the `list-hyperopts` subcommand to list custom Hyperopts.
2019-12-24 14:35:53 +00:00
```
freqtrade list-strategies --help
usage: freqtrade list-strategies [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH] [--userdir PATH] [--strategy-path PATH] [-1]
optional arguments:
-h, --help show this help message and exit
--strategy-path PATH Specify additional strategy lookup path.
-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.
```
2020-02-02 15:56:54 +00:00
```
freqtrade list-hyperopts --help
usage: freqtrade list-hyperopts [-h] [-v] [--logfile FILE] [-V] [-c PATH]
[-d PATH] [--userdir PATH]
[--hyperopt-path PATH] [-1]
optional arguments:
-h, --help show this help message and exit
--hyperopt-path PATH Specify additional lookup path for Hyperopt and
Hyperopt Loss functions.
-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.
```
2019-12-24 14:40:49 +00:00
!!! Warning
2020-02-02 15:56:54 +00:00
Using these commands will try to load all python files from a directory. This can be a security risk if untrusted files reside in this directory, since all module-level code is executed.
2019-12-24 14:40:49 +00:00
2020-02-02 15:56:54 +00:00
Example: Search default strategies and hyperopts directories (within the default userdir).
``` bash
freqtrade list-strategies
freqtrade list-hyperopts
```
Example: Search strategies and hyperopts directory within the userdir.
2019-12-24 14:35:53 +00:00
``` bash
2019-12-28 05:25:45 +00:00
freqtrade list-strategies --userdir ~/.freqtrade/
2020-02-02 15:56:54 +00:00
freqtrade list-hyperopts --userdir ~/.freqtrade/
2019-12-24 14:35:53 +00:00
```
2020-02-02 15:56:54 +00:00
Example: Search dedicated strategy path.
2019-12-24 14:35:53 +00:00
``` bash
freqtrade list-strategies --strategy-path ~/.freqtrade/strategies/
```
2020-02-02 15:56:54 +00:00
Example: Search dedicated hyperopt path.
``` bash
freqtrade list-hyperopt --hyperopt-path ~/.freqtrade/hyperopts/
```
2019-09-30 18:36:52 +00:00
## List Exchanges
2019-10-01 17:26:44 +00:00
Use the `list-exchanges` subcommand to see the exchanges available for the bot.
2019-09-30 18:36:52 +00:00
```
2019-10-01 13:57:35 +00:00
usage: freqtrade list-exchanges [-h] [-1] [-a]
2019-09-30 18:36:52 +00:00
optional arguments:
-h, --help show this help message and exit
2019-10-10 17:44:24 +00:00
-1, --one-column Print output in one column.
2019-10-01 13:57:35 +00:00
-a, --all Print all exchanges known to the ccxt library.
2019-09-30 18:36:52 +00:00
```
2019-10-01 17:26:44 +00:00
* Example: see exchanges available for the bot:
```
$ freqtrade list-exchanges
Exchanges available for Freqtrade: _1btcxe, acx, allcoin, bequant, bibox, binance, binanceje, binanceus, bitbank, bitfinex, bitfinex2, bitkk, bitlish, bitmart, bittrex, bitz, bleutrade, btcalpha, btcmarkets, btcturk, buda, cex, cobinhood, coinbaseprime, coinbasepro, coinex, cointiger, coss, crex24, digifinex, dsx, dx, ethfinex, fcoin, fcoinjp, gateio, gdax, gemini, hitbtc2, huobipro, huobiru, idex, kkex, kraken, kucoin, kucoin2, kuna, lbank, mandala, mercado, oceanex, okcoincny, okcoinusd, okex, okex3, poloniex, rightbtc, theocean, tidebit, upbit, zb
```
* Example: see all exchanges supported by the ccxt library (including 'bad' ones, i.e. those that are known to not work with Freqtrade):
```
$ freqtrade list-exchanges -a
All exchanges supported by the ccxt library: _1btcxe, acx, adara, allcoin, anxpro, bcex, bequant, bibox, bigone, binance, binanceje, binanceus, bit2c, bitbank, bitbay, bitfinex, bitfinex2, bitflyer, bitforex, bithumb, bitkk, bitlish, bitmart, bitmex, bitso, bitstamp, bitstamp1, bittrex, bitz, bl3p, bleutrade, braziliex, btcalpha, btcbox, btcchina, btcmarkets, btctradeim, btctradeua, btcturk, buda, bxinth, cex, chilebit, cobinhood, coinbase, coinbaseprime, coinbasepro, coincheck, coinegg, coinex, coinexchange, coinfalcon, coinfloor, coingi, coinmarketcap, coinmate, coinone, coinspot, cointiger, coolcoin, coss, crex24, crypton, deribit, digifinex, dsx, dx, ethfinex, exmo, exx, fcoin, fcoinjp, flowbtc, foxbit, fybse, gateio, gdax, gemini, hitbtc, hitbtc2, huobipro, huobiru, ice3x, idex, independentreserve, indodax, itbit, kkex, kraken, kucoin, kucoin2, kuna, lakebtc, latoken, lbank, liquid, livecoin, luno, lykke, mandala, mercado, mixcoins, negociecoins, nova, oceanex, okcoincny, okcoinusd, okex, okex3, paymium, poloniex, rightbtc, southxchange, stronghold, surbitcoin, theocean, therock, tidebit, tidex, upbit, vaultoro, vbtc, virwox, xbtce, yobit, zaif, zb
```
2019-09-30 18:36:52 +00:00
## List Timeframes
2019-10-01 17:26:44 +00:00
Use the `list-timeframes` subcommand to see the list of ticker intervals (timeframes) available for the exchange.
2019-09-30 18:36:52 +00:00
```
2020-02-01 12:52:25 +00:00
usage: freqtrade list-timeframes [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH] [--userdir PATH] [--exchange EXCHANGE] [-1]
2019-09-30 18:36:52 +00:00
optional arguments:
2020-02-01 12:52:25 +00:00
-h, --help show this help message and exit
--exchange EXCHANGE Exchange name (default: `bittrex` ). Only valid if no config is provided.
-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.
2019-09-30 18:36:52 +00:00
```
2019-10-01 17:26:44 +00:00
* Example: see the timeframes for the 'binance' exchange, set in the configuration file:
```
2020-02-01 12:52:25 +00:00
$ freqtrade list-timeframes -c config_binance.json
2019-10-01 17:26:44 +00:00
...
Timeframes available for the exchange `binance` : 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M
```
* Example: enumerate exchanges available for Freqtrade and print timeframes supported by each of them:
```
$ for i in `freqtrade list-exchanges -1` ; do freqtrade list-timeframes --exchange $i; done
```
2019-10-17 14:18:26 +00:00
## List pairs/list markets
The `list-pairs` and `list-markets` subcommands allow to see the pairs/markets available on exchange.
2019-10-20 20:00:17 +00:00
Pairs are markets with the '/' character between the base currency part and the quote currency part in the market symbol.
For example, in the 'ETH/BTC' pair 'ETH' is the base currency, while 'BTC' is the quote currency.
2019-10-21 11:06:46 +00:00
For pairs traded by Freqtrade the pair quote currency is defined by the value of the `stake_currency` configuration setting.
You can print info about any pair/market with these subcommands - and you can filter output by quote-currency using `--quote BTC` , or by base-currency using `--base ETH` options correspondingly.
2019-10-17 14:18:26 +00:00
These subcommands have same usage and same set of available options:
```
2020-02-01 12:52:25 +00:00
usage: freqtrade list-markets [-h] [-v] [--logfile FILE] [-V] [-c PATH]
[-d PATH] [--userdir PATH] [--exchange EXCHANGE]
[--print-list] [--print-json] [-1] [--print-csv]
2019-10-20 20:00:17 +00:00
[--base BASE_CURRENCY [BASE_CURRENCY ...]]
[--quote QUOTE_CURRENCY [QUOTE_CURRENCY ...]]
[-a]
2020-02-01 12:52:25 +00:00
usage: freqtrade list-pairs [-h] [-v] [--logfile FILE] [-V] [-c PATH]
[-d PATH] [--userdir PATH] [--exchange EXCHANGE]
[--print-list] [--print-json] [-1] [--print-csv]
2019-10-20 20:00:17 +00:00
[--base BASE_CURRENCY [BASE_CURRENCY ...]]
[--quote QUOTE_CURRENCY [QUOTE_CURRENCY ...]] [-a]
2019-10-17 14:18:26 +00:00
optional arguments:
-h, --help show this help message and exit
--exchange EXCHANGE Exchange name (default: `bittrex` ). Only valid if no
config is provided.
--print-list Print list of pairs or market symbols. By default data
is printed in the tabular format.
--print-json Print list of pairs or market symbols in JSON format.
-1, --one-column Print output in one column.
--print-csv Print exchange pair or market data in the csv format.
--base BASE_CURRENCY [BASE_CURRENCY ...]
Specify base currency(-ies). Space-separated list.
--quote QUOTE_CURRENCY [QUOTE_CURRENCY ...]
Specify quote currency(-ies). Space-separated list.
-a, --all Print all pairs or market symbols. By default only
active ones are shown.
2020-02-01 12:52:25 +00:00
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.
2019-10-17 14:18:26 +00:00
```
By default, only active pairs/markets are shown. Active pairs/markets are those that can currently be traded
on the exchange. The see the list of all pairs/markets (not only the active ones), use the `-a` /`-all` option.
Pairs/markets are sorted by its symbol string in the printed output.
### Examples
* Print the list of active pairs with quote currency USD on exchange, specified in the default
configuration file (i.e. pairs on the "Bittrex" exchange) in JSON format:
```
$ freqtrade list-pairs --quote USD --print-json
```
* Print the list of all pairs on the exchange, specified in the `config_binance.json` configuration file
(i.e. on the "Binance" exchange) with base currencies BTC or ETH and quote currencies USDT or USD, as the
human-readable list with summary:
```
2020-02-01 12:52:25 +00:00
$ freqtrade list-pairs -c config_binance.json --all --base BTC ETH --quote USDT USD --print-list
2019-10-17 14:18:26 +00:00
```
* Print all markets on exchange "Kraken", in the tabular format:
```
$ freqtrade list-markets --exchange kraken --all
```
2019-12-03 15:15:10 +00:00
## Test pairlist
Use the `test-pairlist` subcommand to test the configuration of [dynamic pairlists ](configuration.md#pairlists ).
Requires a configuration with specified `pairlists` attribute.
Can be used to generate static pairlists to be used during backtesting / hyperopt.
```
usage: freqtrade test-pairlist [-h] [-c PATH]
[--quote QUOTE_CURRENCY [QUOTE_CURRENCY ...]]
[-1] [--print-json]
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.
--quote QUOTE_CURRENCY [QUOTE_CURRENCY ...]
Specify quote currency(-ies). Space-separated list.
-1, --one-column Print output in one column.
--print-json Print list of pairs or market symbols in JSON format.
```
2019-12-04 13:30:53 +00:00
### Examples
Show whitelist when using a [dynamic pairlist ](configuration.md#pairlists ).
```
freqtrade test-pairlist --config config.json --quote USDT BTC
```
2019-12-05 11:16:18 +00:00
## List Hyperopt results
You can list the hyperoptimization epochs the Hyperopt module evaluated previously with the `hyperopt-list` subcommand.
```
usage: freqtrade hyperopt-list [-h] [-v] [--logfile FILE] [-V] [-c PATH]
[-d PATH] [--userdir PATH] [--best]
2020-02-10 19:54:31 +00:00
[--profitable] [--min-avg-time FLOAT]
[--max-avg-time FLOAT] [--min-avg-profit FLOAT]
[--min-total-profit FLOAT] [--no-color]
[--print-json] [--no-details]
2019-12-05 11:16:18 +00:00
optional arguments:
-h, --help show this help message and exit
--best Select only best epochs.
--profitable Select only profitable epochs.
2020-02-10 19:54:31 +00:00
--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.
2019-12-05 11:16:18 +00:00
--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.
2020-02-10 19:54:31 +00:00
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.
2019-12-09 21:33:57 +00:00
```
2019-12-05 11:16:18 +00:00
### Examples
List all results, print details of the best result at the end:
```
freqtrade hyperopt-list
```
List only epochs with positive profit. Do not print the details of the best epoch, so that the list can be iterated in a script:
```
freqtrade hyperopt-list --profitable --no-details
```
## Show details of Hyperopt results
You can show the details of any hyperoptimization epoch previously evaluated by the Hyperopt module with the `hyperopt-show` subcommand.
```
usage: freqtrade hyperopt-show [-h] [-v] [--logfile FILE] [-V] [-c PATH]
[-d PATH] [--userdir PATH] [--best]
[--profitable] [-n INT] [--print-json]
[--no-header]
optional arguments:
-h, --help show this help message and exit
--best Select only best epochs.
--profitable Select only profitable epochs.
-n INT, --index INT Specify the index of the epoch to print details for.
--print-json Print best result detailization in JSON format.
--no-header Do not print epoch details header.
```
### Examples
Print details for the epoch 168 (the number of the epoch is shown by the `hyperopt-list` subcommand or by Hyperopt itself during hyperoptimization run):
```
freqtrade hyperopt-show -n 168
```
Prints JSON data with details for the last best epoch (i.e., the best of all epochs):
```
freqtrade hyperopt-show --best -n -1 --print-json --no-header
```