Elffuss BraidHub

kikocis/freqtrade public

develop · 8.9 KiBRenderedRawPermalink
1# Start the bot
2
3This page explains the different parameters of the bot and how to run it.
4
5!!! Note
6 If you've used `setup.sh`, don't forget to activate your virtual environment (`source .env/bin/activate`) before running freqtrade commands.
7
8!!! Warning "Up-to-date clock"
9 The clock on the system running the bot must be accurate, synchronized to a NTP server frequently enough to avoid problems with communication to the exchanges.
10
11## Bot commands
12
13```
14usage: freqtrade [-h] [-V]
15 {trade,create-userdir,new-config,new-hyperopt,new-strategy,download-data,convert-data,convert-trade-data,backtesting,edge,hyperopt,hyperopt-list,hyperopt-show,list-exchanges,list-hyperopts,list-markets,list-pairs,list-strategies,list-timeframes,show-trades,test-pairlist,plot-dataframe,plot-profit}
16 ...
17
18Free, open source crypto trading bot
19
20positional arguments:
21 {trade,create-userdir,new-config,new-hyperopt,new-strategy,download-data,convert-data,convert-trade-data,backtesting,edge,hyperopt,hyperopt-list,hyperopt-show,list-exchanges,list-hyperopts,list-markets,list-pairs,list-strategies,list-timeframes,show-trades,test-pairlist,plot-dataframe,plot-profit}
22 trade Trade module.
23 create-userdir Create user-data directory.
24 new-config Create new config
25 new-hyperopt Create new hyperopt
26 new-strategy Create new strategy
27 download-data Download backtesting data.
28 convert-data Convert candle (OHLCV) data from one format to
29 another.
30 convert-trade-data Convert trade data from one format to another.
31 backtesting Backtesting module.
32 edge Edge module.
33 hyperopt Hyperopt module.
34 hyperopt-list List Hyperopt results
35 hyperopt-show Show details of Hyperopt results
36 list-exchanges Print available exchanges.
37 list-hyperopts Print available hyperopt classes.
38 list-markets Print markets on exchange.
39 list-pairs Print pairs on exchange.
40 list-strategies Print available strategies.
41 list-timeframes Print available timeframes for the exchange.
42 show-trades Show trades.
43 test-pairlist Test your pairlist configuration.
44 plot-dataframe Plot candles with indicators.
45 plot-profit Generate plot showing profits.
46
47optional arguments:
48 -h, --help show this help message and exit
49 -V, --version show program's version number and exit
50
51```
52
53### Bot trading commands
54
55```
56usage: freqtrade trade [-h] [-v] [--logfile FILE] [-V] [-c PATH] [-d PATH]
57 [--userdir PATH] [-s NAME] [--strategy-path PATH]
58 [--db-url PATH] [--sd-notify] [--dry-run]
59 [--dry-run-wallet DRY_RUN_WALLET]
60
61optional arguments:
62 -h, --help show this help message and exit
63 --db-url PATH Override trades database URL, this is useful in custom
64 deployments (default: `sqlite:///tradesv3.sqlite` for
65 Live Run mode, `sqlite:///tradesv3.dryrun.sqlite` for
66 Dry Run).
67 --sd-notify Notify systemd service manager.
68 --dry-run Enforce dry-run for trading (removes Exchange secrets
69 and simulates trades).
70 --dry-run-wallet DRY_RUN_WALLET, --starting-balance DRY_RUN_WALLET
71 Starting balance, used for backtesting / hyperopt and
72 dry-runs.
73
74Common arguments:
75 -v, --verbose Verbose mode (-vv for more, -vvv to get all messages).
76 --logfile FILE Log to the file specified. Special values are:
77 'syslog', 'journald'. See the documentation for more
78 details.
79 -V, --version show program's version number and exit
80 -c PATH, --config PATH
81 Specify configuration file (default:
82 `userdir/config.json` or `config.json` whichever
83 exists). Multiple --config options may be used. Can be
84 set to `-` to read config from stdin.
85 -d PATH, --datadir PATH
86 Path to directory with historical backtesting data.
87 --userdir PATH, --user-data-dir PATH
88 Path to userdata directory.
89
90Strategy arguments:
91 -s NAME, --strategy NAME
92 Specify strategy class name which will be used by the
93 bot.
94 --strategy-path PATH Specify additional strategy lookup path.
95
96```
97
98### How to specify which configuration file be used?
99
100The bot allows you to select which configuration file you want to use by means of
101the `-c/--config` command line option:
102
103```bash
104freqtrade trade -c path/far/far/away/config.json
105```
106
107Per default, the bot loads the `config.json` configuration file from the current
108working directory.
109
110### How to use multiple configuration files?
111
112The bot allows you to use multiple configuration files by specifying multiple
113`-c/--config` options in the command line. Configuration parameters
114defined in the latter configuration files override parameters with the same name
115defined in the previous configuration files specified in the command line earlier.
116
117For example, you can make a separate configuration file with your key and secret
118for the Exchange you use for trading, specify default configuration file with
119empty key and secret values while running in the Dry Mode (which does not actually
120require them):
121
122```bash
123freqtrade trade -c ./config.json
124```
125
126and specify both configuration files when running in the normal Live Trade Mode:
127
128```bash
129freqtrade trade -c ./config.json -c path/to/secrets/keys.config.json
130```
131
132This could help you hide your private Exchange key and Exchange secret on you local machine
133by setting appropriate file permissions for the file which contains actual secrets and, additionally,
134prevent unintended disclosure of sensitive private data when you publish examples
135of your configuration in the project issues or in the Internet.
136
137See more details on this technique with examples in the documentation page on
138[configuration](configuration.md).
139
140### Where to store custom data
141
142Freqtrade allows the creation of a user-data directory using `freqtrade create-userdir --userdir someDirectory`.
143This directory will look as follows:
144
145```
146user_data/
147├── backtest_results
148├── data
149├── hyperopts
150├── hyperopt_results
151├── plot
152└── strategies
153```
154
155You can add the entry "user_data_dir" setting to your configuration, to always point your bot to this directory.
156Alternatively, pass in `--userdir` to every command.
157The bot will fail to start if the directory does not exist, but will create necessary subdirectories.
158
159This directory should contain your custom strategies, custom hyperopts and hyperopt loss functions, backtesting historical data (downloaded using either backtesting command or the download script) and plot outputs.
160
161It is recommended to use version control to keep track of changes to your strategies.
162
163### How to use **--strategy**?
164
165This parameter will allow you to load your custom strategy class.
166To test the bot installation, you can use the `SampleStrategy` installed by the `create-userdir` subcommand (usually `user_data/strategy/sample_strategy.py`).
167
168The bot will search your strategy file within `user_data/strategies`.
169To use other directories, please read the next section about `--strategy-path`.
170
171To load a strategy, simply pass the class name (e.g.: `CustomStrategy`) in this parameter.
172
173**Example:**
174In `user_data/strategies` you have a file `my_awesome_strategy.py` which has
175a strategy class called `AwesomeStrategy` to load it:
176
177```bash
178freqtrade trade --strategy AwesomeStrategy
179```
180
181If the bot does not find your strategy file, it will display in an error
182message the reason (File not found, or errors in your code).
183
184Learn more about strategy file in
185[Strategy Customization](strategy-customization.md).
186
187### How to use **--strategy-path**?
188
189This parameter allows you to add an additional strategy lookup path, which gets
190checked before the default locations (The passed path must be a directory!):
191
192```bash
193freqtrade trade --strategy AwesomeStrategy --strategy-path /some/directory
194```
195
196#### How to install a strategy?
197
198This is very simple. Copy paste your strategy file into the directory
199`user_data/strategies` or use `--strategy-path`. And voila, the bot is ready to use it.
200
201### How to use **--db-url**?
202
203When you run the bot in Dry-run mode, per default no transactions are
204stored in a database. If you want to store your bot actions in a DB
205using `--db-url`. This can also be used to specify a custom database
206in production mode. Example command:
207
208```bash
209freqtrade trade -c config.json --db-url sqlite:///tradesv3.dry_run.sqlite
210```
211
212## Next step
213
214The optimal strategy of the bot will change with time depending of the market trends. The next step is to
215[Strategy Customization](strategy-customization.md).