Elffuss BraidHub

kikocis/freqtrade public

develop · 39.9 KiBRenderedRawPermalink
1# Configure the bot
2
3Freqtrade has many configurable features and possibilities.
4By default, these settings are configured via the configuration file (see below).
5
6## The Freqtrade configuration file
7
8The bot uses a set of configuration parameters during its operation that all together conform the bot configuration. It normally reads its configuration from a file (Freqtrade configuration file).
9
10Per default, the bot loads the configuration from the `config.json` file, located in the current working directory.
11
12You can specify a different configuration file used by the bot with the `-c/--config` command line option.
13
14In some advanced use cases, multiple configuration files can be specified and used by the bot or the bot can read its configuration parameters from the process standard input stream.
15
16If you used the [Quick start](installation.md/#quick-start) method for installing
17the bot, the installation script should have already created the default configuration file (`config.json`) for you.
18
19If default configuration file is not created we recommend you to use `freqtrade new-config --config config.json` to generate a basic configuration file.
20
21The Freqtrade configuration file is to be written in the JSON format.
22
23Additionally to the standard JSON syntax, you may use one-line `// ...` and multi-line `/* ... */` comments in your configuration files and trailing commas in the lists of parameters.
24
25Do not worry if you are not familiar with JSON format -- simply open the configuration file with an editor of your choice, make some changes to the parameters you need, save your changes and, finally, restart the bot or, if it was previously stopped, run it again with the changes you made to the configuration. The bot validates syntax of the configuration file at startup and will warn you if you made any errors editing it, pointing out problematic lines.
26
27## Configuration parameters
28
29The table below will list all configuration parameters available.
30
31Freqtrade can also load many options via command line (CLI) arguments (check out the commands `--help` output for details).
32The prevelance for all Options is as follows:
33
34- CLI arguments override any other option
35- Configuration files are used in sequence (last file wins), and override Strategy configurations.
36- Strategy configurations are only used if they are not set via configuration or via command line arguments. These options are marked with [Strategy Override](#parameters-in-the-strategy) in the below table.
37
38Mandatory parameters are marked as **Required**, which means that they are required to be set in one of the possible ways.
39
40| Parameter | Description |
41|------------|-------------|
42| `max_open_trades` | **Required.** Number of open trades your bot is allowed to have. Only one open trade per pair is possible, so the length of your pairlist is another limitation which can apply. If -1 then it is ignored (i.e. potentially unlimited open trades, limited by the pairlist). [More information below](#configuring-amount-per-trade).<br> **Datatype:** Positive integer or -1.
43| `stake_currency` | **Required.** Crypto-currency used for trading. <br> **Datatype:** String
44| `stake_amount` | **Required.** Amount of crypto-currency your bot will use for each trade. Set it to `"unlimited"` to allow the bot to use all available balance. [More information below](#configuring-amount-per-trade). <br> **Datatype:** Positive float or `"unlimited"`.
45| `tradable_balance_ratio` | Ratio of the total account balance the bot is allowed to trade. [More information below](#configuring-amount-per-trade). <br>*Defaults to `0.99` 99%).*<br> **Datatype:** Positive float between `0.1` and `1.0`.
46| `amend_last_stake_amount` | Use reduced last stake amount if necessary. [More information below](#configuring-amount-per-trade). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
47| `last_stake_amount_min_ratio` | Defines minimum stake amount that has to be left and executed. Applies only to the last stake amount when it's amended to a reduced value (i.e. if `amend_last_stake_amount` is set to `true`). [More information below](#configuring-amount-per-trade). <br>*Defaults to `0.5`.* <br> **Datatype:** Float (as ratio)
48| `amount_reserve_percent` | Reserve some amount in min pair stake amount. The bot will reserve `amount_reserve_percent` + stoploss value when calculating min pair stake amount in order to avoid possible trade refusals. <br>*Defaults to `0.05` (5%).* <br> **Datatype:** Positive Float as ratio.
49| `timeframe` | The timeframe (former ticker interval) to use (e.g `1m`, `5m`, `15m`, `30m`, `1h` ...). [Strategy Override](#parameters-in-the-strategy). <br> **Datatype:** String
50| `fiat_display_currency` | Fiat currency used to show your profits. [More information below](#what-values-can-be-used-for-fiat_display_currency). <br> **Datatype:** String
51| `dry_run` | **Required.** Define if the bot must be in Dry Run or production mode. <br>*Defaults to `true`.* <br> **Datatype:** Boolean
52| `dry_run_wallet` | Define the starting amount in stake currency for the simulated wallet used by the bot running in Dry Run mode.<br>*Defaults to `1000`.* <br> **Datatype:** Float
53| `cancel_open_orders_on_exit` | Cancel open orders when the `/stop` RPC command is issued, `Ctrl+C` is pressed or the bot dies unexpectedly. When set to `true`, this allows you to use `/stop` to cancel unfilled and partially filled orders in the event of a market crash. It does not impact open positions. <br>*Defaults to `false`.* <br> **Datatype:** Boolean
54| `process_only_new_candles` | Enable processing of indicators only when new candles arrive. If false each loop populates the indicators, this will mean the same candle is processed many times creating system load but can be useful of your strategy depends on tick data not only candle. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
55| `minimal_roi` | **Required.** Set the threshold as ratio the bot will use to sell a trade. [More information below](#understand-minimal_roi). [Strategy Override](#parameters-in-the-strategy). <br> **Datatype:** Dict
56| `stoploss` | **Required.** Value as ratio of the stoploss used by the bot. More details in the [stoploss documentation](stoploss.md). [Strategy Override](#parameters-in-the-strategy). <br> **Datatype:** Float (as ratio)
57| `trailing_stop` | Enables trailing stoploss (based on `stoploss` in either configuration or strategy file). More details in the [stoploss documentation](stoploss.md#trailing-stop-loss). [Strategy Override](#parameters-in-the-strategy). <br> **Datatype:** Boolean
58| `trailing_stop_positive` | Changes stoploss once profit has been reached. More details in the [stoploss documentation](stoploss.md#trailing-stop-loss-custom-positive-loss). [Strategy Override](#parameters-in-the-strategy). <br> **Datatype:** Float
59| `trailing_stop_positive_offset` | Offset on when to apply `trailing_stop_positive`. Percentage value which should be positive. More details in the [stoploss documentation](stoploss.md#trailing-stop-loss-only-once-the-trade-has-reached-a-certain-offset). [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `0.0` (no offset).* <br> **Datatype:** Float
60| `trailing_only_offset_is_reached` | Only apply trailing stoploss when the offset is reached. [stoploss documentation](stoploss.md). [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
61| `fee` | Fee used during backtesting / dry-runs. Should normally not be configured, which has freqtrade fall back to the exchange default fee. Set as ratio (e.g. 0.001 = 0.1%). Fee is applied twice for each trade, once when buying, once when selling. <br> **Datatype:** Float (as ratio)
62| `unfilledtimeout.buy` | **Required.** How long (in minutes) the bot will wait for an unfilled buy order to complete, after which the order will be cancelled and repeated at current (new) price, as long as there is a signal. [Strategy Override](#parameters-in-the-strategy).<br> **Datatype:** Integer
63| `unfilledtimeout.sell` | **Required.** How long (in minutes) the bot will wait for an unfilled sell order to complete, after which the order will be cancelled and repeated at current (new) price, as long as there is a signal. [Strategy Override](#parameters-in-the-strategy).<br> **Datatype:** Integer
64| `bid_strategy.price_side` | Select the side of the spread the bot should look at to get the buy rate. [More information below](#buy-price-side).<br> *Defaults to `bid`.* <br> **Datatype:** String (either `ask` or `bid`).
65| `bid_strategy.ask_last_balance` | **Required.** Interpolate the bidding price. More information [below](#buy-price-without-orderbook-enabled).
66| `bid_strategy.use_order_book` | Enable buying using the rates in [Order Book Bids](#buy-price-with-orderbook-enabled). <br> **Datatype:** Boolean
67| `bid_strategy.order_book_top` | Bot will use the top N rate in Order Book Bids to buy. I.e. a value of 2 will allow the bot to pick the 2nd bid rate in [Order Book Bids](#buy-price-with-orderbook-enabled). <br>*Defaults to `1`.* <br> **Datatype:** Positive Integer
68| `bid_strategy. check_depth_of_market.enabled` | Do not buy if the difference of buy orders and sell orders is met in Order Book. [Check market depth](#check-depth-of-market). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
69| `bid_strategy. check_depth_of_market.bids_to_ask_delta` | The difference ratio of buy orders and sell orders found in Order Book. A value below 1 means sell order size is greater, while value greater than 1 means buy order size is higher. [Check market depth](#check-depth-of-market) <br> *Defaults to `0`.* <br> **Datatype:** Float (as ratio)
70| `ask_strategy.price_side` | Select the side of the spread the bot should look at to get the sell rate. [More information below](#sell-price-side).<br> *Defaults to `ask`.* <br> **Datatype:** String (either `ask` or `bid`).
71| `ask_strategy.bid_last_balance` | Interpolate the selling price. More information [below](#sell-price-without-orderbook-enabled).
72| `ask_strategy.use_order_book` | Enable selling of open trades using [Order Book Asks](#sell-price-with-orderbook-enabled). <br> **Datatype:** Boolean
73| `ask_strategy.order_book_min` | Bot will scan from the top min to max Order Book Asks searching for a profitable rate. <br>*Defaults to `1`.* <br> **Datatype:** Positive Integer
74| `ask_strategy.order_book_max` | Bot will scan from the top min to max Order Book Asks searching for a profitable rate. <br>*Defaults to `1`.* <br> **Datatype:** Positive Integer
75| `ask_strategy.use_sell_signal` | Use sell signals produced by the strategy in addition to the `minimal_roi`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `true`.* <br> **Datatype:** Boolean
76| `ask_strategy.sell_profit_only` | Wait until the bot reaches `ask_strategy.sell_profit_offset` before taking a sell decision. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
77| `ask_strategy.sell_profit_offset` | Sell-signal is only active above this value. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `0.0`.* <br> **Datatype:** Float (as ratio)
78| `ask_strategy.ignore_roi_if_buy_signal` | Do not sell if the buy signal is still active. This setting takes preference over `minimal_roi` and `use_sell_signal`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
79| `ask_strategy.ignore_buying_expired_candle_after` | Specifies the number of seconds until a buy signal is no longer used. <br> **Datatype:** Integer
80| `order_types` | Configure order-types depending on the action (`"buy"`, `"sell"`, `"stoploss"`, `"stoploss_on_exchange"`). [More information below](#understand-order_types). [Strategy Override](#parameters-in-the-strategy).<br> **Datatype:** Dict
81| `order_time_in_force` | Configure time in force for buy and sell orders. [More information below](#understand-order_time_in_force). [Strategy Override](#parameters-in-the-strategy). <br> **Datatype:** Dict
82| `exchange.name` | **Required.** Name of the exchange class to use. [List below](#user-content-what-values-for-exchangename). <br> **Datatype:** String
83| `exchange.sandbox` | Use the 'sandbox' version of the exchange, where the exchange provides a sandbox for risk-free integration. See [here](sandbox-testing.md) in more details.<br> **Datatype:** Boolean
84| `exchange.key` | API key to use for the exchange. Only required when you are in production mode.<br>**Keep it in secret, do not disclose publicly.** <br> **Datatype:** String
85| `exchange.secret` | API secret to use for the exchange. Only required when you are in production mode.<br>**Keep it in secret, do not disclose publicly.** <br> **Datatype:** String
86| `exchange.password` | API password to use for the exchange. Only required when you are in production mode and for exchanges that use password for API requests.<br>**Keep it in secret, do not disclose publicly.** <br> **Datatype:** String
87| `exchange.pair_whitelist` | List of pairs to use by the bot for trading and to check for potential trades during backtesting. Supports regex pairs as `.*/BTC`. Not used by VolumePairList. [More information](plugins.md#pairlists-and-pairlist-handlers). <br> **Datatype:** List
88| `exchange.pair_blacklist` | List of pairs the bot must absolutely avoid for trading and backtesting. [More information](plugins.md#pairlists-and-pairlist-handlers). <br> **Datatype:** List
89| `exchange.ccxt_config` | Additional CCXT parameters passed to both ccxt instances (sync and async). This is usually the correct place for ccxt configurations. Parameters may differ from exchange to exchange and are documented in the [ccxt documentation](https://ccxt.readthedocs.io/en/latest/manual.html#instantiation) <br> **Datatype:** Dict
90| `exchange.ccxt_sync_config` | Additional CCXT parameters passed to the regular (sync) ccxt instance. Parameters may differ from exchange to exchange and are documented in the [ccxt documentation](https://ccxt.readthedocs.io/en/latest/manual.html#instantiation) <br> **Datatype:** Dict
91| `exchange.ccxt_async_config` | Additional CCXT parameters passed to the async ccxt instance. Parameters may differ from exchange to exchange and are documented in the [ccxt documentation](https://ccxt.readthedocs.io/en/latest/manual.html#instantiation) <br> **Datatype:** Dict
92| `exchange.markets_refresh_interval` | The interval in minutes in which markets are reloaded. <br>*Defaults to `60` minutes.* <br> **Datatype:** Positive Integer
93| `exchange.skip_pair_validation` | Skip pairlist validation on startup.<br>*Defaults to `false`<br> **Datatype:** Boolean
94| `exchange.skip_open_order_update` | Skips open order updates on startup should the exchange cause problems. Only relevant in live conditions.<br>*Defaults to `false`<br> **Datatype:** Boolean
95| `edge.*` | Please refer to [edge configuration document](edge.md) for detailed explanation.
96| `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
97| `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
98| `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
99| `telegram.enabled` | Enable the usage of Telegram. <br> **Datatype:** Boolean
100| `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
101| `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
102| `telegram.balance_dust_level` | Dust-level (in stake currency) - currencies with a balance below this will not be shown by `/balance`. <br> **Datatype:** float
103| `webhook.enabled` | Enable usage of Webhook notifications <br> **Datatype:** Boolean
104| `webhook.url` | URL for the webhook. Only required if `webhook.enabled` is `true`. See the [webhook documentation](webhook-config.md) for more details. <br> **Datatype:** String
105| `webhook.webhookbuy` | Payload to send on buy. Only required if `webhook.enabled` is `true`. See the [webhook documentation](webhook-config.md) for more details. <br> **Datatype:** String
106| `webhook.webhookbuycancel` | Payload to send on buy order cancel. Only required if `webhook.enabled` is `true`. See the [webhook documentation](webhook-config.md) for more details. <br> **Datatype:** String
107| `webhook.webhooksell` | Payload to send on sell. Only required if `webhook.enabled` is `true`. See the [webhook documentation](webhook-config.md) for more details. <br> **Datatype:** String
108| `webhook.webhooksellcancel` | Payload to send on sell order cancel. Only required if `webhook.enabled` is `true`. See the [webhook documentation](webhook-config.md) for more details. <br> **Datatype:** String
109| `webhook.webhookstatus` | Payload to send on status calls. Only required if `webhook.enabled` is `true`. See the [webhook documentation](webhook-config.md) for more details. <br> **Datatype:** String
110| `api_server.enabled` | Enable usage of API Server. See the [API Server documentation](rest-api.md) for more details. <br> **Datatype:** Boolean
111| `api_server.listen_ip_address` | Bind IP address. See the [API Server documentation](rest-api.md) for more details. <br> **Datatype:** IPv4
112| `api_server.listen_port` | Bind Port. See the [API Server documentation](rest-api.md) for more details. <br>**Datatype:** Integer between 1024 and 65535
113| `api_server.verbosity` | Logging verbosity. `info` will print all RPC Calls, while "error" will only display errors. <br>**Datatype:** Enum, either `info` or `error`. Defaults to `info`.
114| `api_server.username` | Username 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
115| `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
116| `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
117| `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
118| `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`
119| `forcebuy_enable` | Enables the RPC Commands to force a buy. More information below. <br> **Datatype:** Boolean
120| `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
121| `strategy` | **Required** Defines Strategy class to use. Recommended to be set via `--strategy NAME`. <br> **Datatype:** ClassName
122| `strategy_path` | Adds an additional strategy lookup path (must be a directory). <br> **Datatype:** String
123| `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
124| `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
125| `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
126| `logfile` | Specifies logfile name. Uses a rolling strategy for log file rotation for 10 files with the 1MB limit per file. <br> **Datatype:** String
127| `user_data_dir` | Directory containing user data. <br> *Defaults to `./user_data/`*. <br> **Datatype:** String
128| `dataformat_ohlcv` | Data format to use to store historical candle (OHLCV) data. <br> *Defaults to `json`*. <br> **Datatype:** String
129| `dataformat_trades` | Data format to use to store historical trades data. <br> *Defaults to `jsongz`*. <br> **Datatype:** String
130
131### Parameters in the strategy
132
133The following parameters can be set in either configuration file or strategy.
134Values set in the configuration file always overwrite values set in the strategy.
135
136* `minimal_roi`
137* `timeframe`
138* `stoploss`
139* `trailing_stop`
140* `trailing_stop_positive`
141* `trailing_stop_positive_offset`
142* `trailing_only_offset_is_reached`
143* `use_custom_stoploss`
144* `process_only_new_candles`
145* `order_types`
146* `order_time_in_force`
147* `unfilledtimeout`
148* `disable_dataframe_checks`
149* `protections`
150* `use_sell_signal` (ask_strategy)
151* `sell_profit_only` (ask_strategy)
152* `sell_profit_offset` (ask_strategy)
153* `ignore_roi_if_buy_signal` (ask_strategy)
154* `ignore_buying_expired_candle_after` (ask_strategy)
155
156### Configuring amount per trade
157
158There are several methods to configure how much of the stake currency the bot will use to enter a trade. All methods respect the [available balance configuration](#available-balance) as explained below.
159
160#### Minimum trade stake
161
162The minimum stake amount will depend by exchange and pair, and is usually listed in the exchange support pages.
163Assuming the minimum tradable amount for XRP/USD is 20 XRP (given by the exchange), and the price is 0.4$.
164
165The minimum stake amount to buy this pair is therefore `20 * 0.6 ~= 12`.
166This exchange has also a limit on USD - where all orders must be > 10$ - which however does not apply in this case.
167
168To guarantee safe execution, freqtrade will not allow buying with a stake-amount of 10.1$, instead, it'll make sure that there's enough space to place a stoploss below the pair (+ an offset, defined by `amount_reserve_percent`, which defaults to 5%).
169
170With a reserve of 5%, the minimum stake amount would be ~12.6$ (`12 * (1 + 0.05)`). If we take in account a stoploss of 10% on top of that - we'd end up with a value of ~14$ (`12.6 / (1 - 0.1)`).
171
172To limit this calculation in case of large stoploss values, the calculated minimum stake-limit will never be more than 50% above the real limit.
173
174!!! Warning
175 Since the limits on exchanges are usually stable and are not updated often, some pairs can show pretty high minimum limits, simply because the price increased a lot since the last limit adjustment by the exchange.
176
177#### Available balance
178
179By default, the bot assumes that the `complete amount - 1%` is at it's disposal, and when using [dynamic stake amount](#dynamic-stake-amount), it will split the complete balance into `max_open_trades` buckets per trade.
180Freqtrade will reserve 1% for eventual fees when entering a trade and will therefore not touch that by default.
181
182You can configure the "untouched" amount by using the `tradable_balance_ratio` setting.
183
184For example, if you have 10 ETH available in your wallet on the exchange and `tradable_balance_ratio=0.5` (which is 50%), then the bot will use a maximum amount of 5 ETH for trading and considers this as available balance. The rest of the wallet is untouched by the trades.
185
186!!! Warning
187 The `tradable_balance_ratio` setting applies to the current balance (free balance + tied up in trades). Therefore, assuming the starting balance of 1000, a configuration with `tradable_balance_ratio=0.99` will not guarantee that 10 currency units will always remain available on the exchange. For example, the free amount may reduce to 5 units if the total balance is reduced to 500 (either by a losing streak, or by withdrawing balance).
188
189#### Amend last stake amount
190
191Assuming we have the tradable balance of 1000 USDT, `stake_amount=400`, and `max_open_trades=3`.
192The bot would open 2 trades, and will be unable to fill the last trading slot, since the requested 400 USDT are no longer available, since 800 USDT are already tied in other trades.
193
194To overcome this, the option `amend_last_stake_amount` can be set to `True`, which will enable the bot to reduce stake_amount to the available balance in order to fill the last trade slot.
195
196In the example above this would mean:
197
198- Trade1: 400 USDT
199- Trade2: 400 USDT
200- Trade3: 200 USDT
201
202!!! Note
203 This option only applies with [Static stake amount](#static-stake-amount) - since [Dynamic stake amount](#dynamic-stake-amount) divides the balances evenly.
204
205!!! Note
206 The minimum last stake amount can be configured using `last_stake_amount_min_ratio` - which defaults to 0.5 (50%). This means that the minimum stake amount that's ever used is `stake_amount * 0.5`. This avoids very low stake amounts, that are close to the minimum tradable amount for the pair and can be refused by the exchange.
207
208#### Static stake amount
209
210The `stake_amount` configuration statically configures the amount of stake-currency your bot will use for each trade.
211
212The minimal configuration value is 0.0001, however, please check your exchange's trading minimums for the stake currency you're using to avoid problems.
213
214This setting works in combination with `max_open_trades`. The maximum capital engaged in trades is `stake_amount * max_open_trades`.
215For example, the bot will at most use (0.05 BTC x 3) = 0.15 BTC, assuming a configuration of `max_open_trades=3` and `stake_amount=0.05`.
216
217!!! Note
218 This setting respects the [available balance configuration](#available-balance).
219
220#### Dynamic stake amount
221
222Alternatively, you can use a dynamic stake amount, which will use the available balance on the exchange, and divide that equally by the amount of allowed trades (`max_open_trades`).
223
224To configure this, set `stake_amount="unlimited"`. We also recommend to set `tradable_balance_ratio=0.99` (99%) - to keep a minimum balance for eventual fees.
225
226In this case a trade amount is calculated as:
227
228```python
229currency_balance / (max_open_trades - current_open_trades)
230```
231
232To allow the bot to trade all the available `stake_currency` in your account (minus `tradable_balance_ratio`) set
233
234```json
235"stake_amount" : "unlimited",
236"tradable_balance_ratio": 0.99,
237```
238
239!!! Tip "Compounding profits"
240 This configuration will allow increasing / decreasing stakes depending on the performance of the bot (lower stake if bot is loosing, higher stakes if the bot has a winning record, since higher balances are available), and will result in profit compounding.
241
242!!! Note "When using Dry-Run Mode"
243 When using `"stake_amount" : "unlimited",` in combination with Dry-Run, Backtesting or Hyperopt, the balance will be simulated starting with a stake of `dry_run_wallet` which will evolve over time.
244 It is therefore important to set `dry_run_wallet` to a sensible value (like 0.05 or 0.01 for BTC and 1000 or 100 for USDT, for example), otherwise it may simulate trades with 100 BTC (or more) or 0.05 USDT (or less) at once - which may not correspond to your real available balance or is less than the exchange minimal limit for the order amount for the stake currency.
245
246--8<-- "includes/pricing.md"
247
248### Understand minimal_roi
249
250The `minimal_roi` configuration parameter is a JSON object where the key is a duration
251in minutes and the value is the minimum ROI as ratio.
252See the example below:
253
254```json
255"minimal_roi": {
256 "40": 0.0, # Sell after 40 minutes if the profit is not negative
257 "30": 0.01, # Sell after 30 minutes if there is at least 1% profit
258 "20": 0.02, # Sell after 20 minutes if there is at least 2% profit
259 "0": 0.04 # Sell immediately if there is at least 4% profit
260},
261```
262
263Most of the strategy files already include the optimal `minimal_roi` value.
264This parameter can be set in either Strategy or Configuration file. If you use it in the configuration file, it will override the
265`minimal_roi` value from the strategy file.
266If it is not set in either Strategy or Configuration, a default of 1000% `{"0": 10}` is used, and minimal roi is disabled unless your trade generates 1000% profit.
267
268!!! Note "Special case to forcesell after a specific time"
269 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.
270
271### Understand forcebuy_enable
272
273The `forcebuy_enable` configuration parameter enables the usage of forcebuy commands via Telegram and REST API.
274For security reasons, it's disabled by default, and freqtrade will show a warning message on startup if enabled.
275For 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.
276
277This can be dangerous with some strategies, so use with care.
278
279See [the telegram documentation](telegram-usage.md) for details on usage.
280
281### Ignoring expired candles
282
283When 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.
284
285In these situations, you can enable the functionality to ignore candles that are beyond a specified period by setting `ask_strategy.ignore_buying_expired_candle_after` to a positive number, indicating the number of seconds after which the buy signal becomes expired.
286
287For example, if your strategy is using a 1h timeframe, and you only want to buy within the first 5 minutes when a new candle comes in, you can add the following configuration to your strategy:
288
289``` json
290 "ask_strategy":{
291 "ignore_buying_expired_candle_after": 300,
292 "price_side": "bid",
293 // ...
294 },
295```
296
297### Understand order_types
298
299The `order_types` configuration parameter maps actions (`buy`, `sell`, `stoploss`, `emergencysell`, `forcesell`, `forcebuy`) to order-types (`market`, `limit`, ...) as well as configures stoploss to be on the exchange and defines stoploss on exchange update interval in seconds.
300
301This allows to buy using limit orders, sell using
302limit-orders, and create stoplosses using market orders. It also allows to set the
303stoploss "on exchange" which means stoploss order would be placed immediately once
304the buy order is fulfilled.
305
306`order_types` set in the configuration file overwrites values set in the strategy as a whole, so you need to configure the whole `order_types` dictionary in one place.
307
308If this is configured, the following 4 values (`buy`, `sell`, `stoploss` and
309`stoploss_on_exchange`) need to be present, otherwise the bot will fail to start.
310
311For information on (`emergencysell`,`forcesell`, `forcebuy`, `stoploss_on_exchange`,`stoploss_on_exchange_interval`,`stoploss_on_exchange_limit_ratio`) please see stop loss documentation [stop loss on exchange](stoploss.md)
312
313Syntax for Strategy:
314
315```python
316order_types = {
317 "buy": "limit",
318 "sell": "limit",
319 "emergencysell": "market",
320 "forcebuy": "market",
321 "forcesell": "market",
322 "stoploss": "market",
323 "stoploss_on_exchange": False,
324 "stoploss_on_exchange_interval": 60,
325 "stoploss_on_exchange_limit_ratio": 0.99,
326}
327```
328
329Configuration:
330
331```json
332"order_types": {
333 "buy": "limit",
334 "sell": "limit",
335 "emergencysell": "market",
336 "forcebuy": "market",
337 "forcesell": "market",
338 "stoploss": "market",
339 "stoploss_on_exchange": false,
340 "stoploss_on_exchange_interval": 60
341}
342```
343
344!!! Note "Market order support"
345 Not all exchanges support "market" orders.
346 The following message will be shown if your exchange does not support market orders:
347 `"Exchange <yourexchange> does not support market orders."` and the bot will refuse to start.
348
349!!! Warning "Using market orders"
350 Please carefully read the section [Market order pricing](#market-order-pricing) section when using market orders.
351
352!!! Note "Stoploss on exchange"
353 `stoploss_on_exchange_interval` is not mandatory. Do not change its value if you are
354 unsure of what you are doing. For more information about how stoploss works please
355 refer to [the stoploss documentation](stoploss.md).
356
357 If `stoploss_on_exchange` is enabled and the stoploss is cancelled manually on the exchange, then the bot will create a new stoploss order.
358
359!!! Warning "Warning: stoploss_on_exchange failures"
360 If stoploss on exchange creation fails for some reason, then an "emergency sell" is initiated. By default, this will sell the asset using a market order. The order-type for the emergency-sell can be changed by setting the `emergencysell` value in the `order_types` dictionary - however this is not advised.
361
362### Understand order_time_in_force
363
364The `order_time_in_force` configuration parameter defines the policy by which the order
365is executed on the exchange. Three commonly used time in force are:
366
367**GTC (Good Till Canceled):**
368
369This is most of the time the default time in force. It means the order will remain
370on exchange till it is canceled by user. It can be fully or partially fulfilled.
371If partially fulfilled, the remaining will stay on the exchange till cancelled.
372
373**FOK (Fill Or Kill):**
374
375It means if the order is not executed immediately AND fully then it is canceled by the exchange.
376
377**IOC (Immediate Or Canceled):**
378
379It is the same as FOK (above) except it can be partially fulfilled. The remaining part
380is automatically cancelled by the exchange.
381
382The `order_time_in_force` parameter contains a dict with buy and sell time in force policy values.
383This can be set in the configuration file or in the strategy.
384Values set in the configuration file overwrites values set in the strategy.
385
386The possible values are: `gtc` (default), `fok` or `ioc`.
387
388``` python
389"order_time_in_force": {
390 "buy": "gtc",
391 "sell": "gtc"
392},
393```
394
395!!! Warning
396 This is an ongoing work. For now it is supported only for binance and only for buy orders.
397 Please don't change the default value unless you know what you are doing.
398
399### Exchange configuration
400
401Freqtrade is based on [CCXT library](https://github.com/ccxt/ccxt) that supports over 100 cryptocurrency
402exchange markets and trading APIs. The complete up-to-date list can be found in the
403[CCXT repo homepage](https://github.com/ccxt/ccxt/tree/master/python).
404 However, the bot was tested by the development team with only Bittrex, Binance and Kraken,
405 so the these are the only officially supported exchanges:
406
407- [Bittrex](https://bittrex.com/): "bittrex"
408- [Binance](https://www.binance.com/): "binance"
409- [Kraken](https://kraken.com/): "kraken"
410
411Feel free to test other exchanges and submit your PR to improve the bot.
412
413Some exchanges require special configuration, which can be found on the [Exchange-specific Notes](exchanges.md) documentation page.
414
415#### Sample exchange configuration
416
417A exchange configuration for "binance" would look as follows:
418
419```json
420"exchange": {
421 "name": "binance",
422 "key": "your_exchange_key",
423 "secret": "your_exchange_secret",
424 "ccxt_config": {"enableRateLimit": true},
425 "ccxt_async_config": {
426 "enableRateLimit": true,
427 "rateLimit": 200
428 },
429```
430
431This configuration enables binance, as well as rate limiting to avoid bans from the exchange.
432`"rateLimit": 200` defines a wait-event of 0.2s between each call. This can also be completely disabled by setting `"enableRateLimit"` to false.
433
434!!! Note
435 Optimal settings for rate limiting depend on the exchange and the size of the whitelist, so an ideal parameter will vary on many other settings.
436 We try to provide sensible defaults per exchange where possible, if you encounter bans please make sure that `"enableRateLimit"` is enabled and increase the `"rateLimit"` parameter step by step.
437
438### What values can be used for fiat_display_currency?
439
440The `fiat_display_currency` configuration parameter sets the base currency to use for the
441conversion from coin to fiat in the bot Telegram reports.
442
443The valid values are:
444
445```json
446"AUD", "BRL", "CAD", "CHF", "CLP", "CNY", "CZK", "DKK", "EUR", "GBP", "HKD", "HUF", "IDR", "ILS", "INR", "JPY", "KRW", "MXN", "MYR", "NOK", "NZD", "PHP", "PKR", "PLN", "RUB", "SEK", "SGD", "THB", "TRY", "TWD", "ZAR", "USD"
447```
448
449In addition to fiat currencies, a range of cryto currencies are supported.
450
451The valid values are:
452
453```json
454"BTC", "ETH", "XRP", "LTC", "BCH", "USDT"
455```
456
457## Using Dry-run mode
458
459We recommend starting the bot in the Dry-run mode to see how your bot will
460behave and what is the performance of your strategy. In the Dry-run mode the
461bot does not engage your money. It only runs a live simulation without
462creating trades on the exchange.
463
4641. Edit your `config.json` configuration file.
4652. Switch `dry-run` to `true` and specify `db_url` for a persistence database.
466
467```json
468"dry_run": true,
469"db_url": "sqlite:///tradesv3.dryrun.sqlite",
470```
471
4723. Remove your Exchange API key and secret (change them by empty values or fake credentials):
473
474```json
475"exchange": {
476 "name": "bittrex",
477 "key": "key",
478 "secret": "secret",
479 ...
480}
481```
482
483Once you will be happy with your bot performance running in the Dry-run mode, you can switch it to production mode.
484
485!!! Note
486 A simulated wallet is available during dry-run mode, and will assume a starting capital of `dry_run_wallet` (defaults to 1000).
487
488### Considerations for dry-run
489
490* 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.
491* Wallets (`/balance`) are simulated based on `dry_run_wallet`.
492* Orders are simulated, and will not be posted to the exchange.
493* Orders are assumed to fill immediately, and will never time out.
494* In combination with `stoploss_on_exchange`, the stop_loss price is assumed to be filled.
495* Open orders (not trades, which are stored in the database) are reset on bot restart.
496
497## Switch to production mode
498
499In production mode, the bot will engage your money. Be careful, since a wrong
500strategy can lose all your money. Be aware of what you are doing when
501you run it in production mode.
502
503### Setup your exchange account
504
505You will need to create API Keys (usually you get `key` and `secret`, some exchanges require an additional `password`) from the Exchange website and you'll need to insert this into the appropriate fields in the configuration or when asked by the `freqtrade new-config` command.
506API Keys are usually only required for live trading (trading for real money, bot running in "production mode", executing real orders on the exchange) and are not required for the bot running in dry-run (trade simulation) mode. When you setup the bot in dry-run mode, you may fill these fields with empty values.
507
508### To switch your bot in production mode
509
510**Edit your `config.json` file.**
511
512**Switch dry-run to false and don't forget to adapt your database URL if set:**
513
514```json
515"dry_run": false,
516```
517
518**Insert your Exchange API key (change them by fake api keys):**
519
520```json
521"exchange": {
522 "name": "bittrex",
523 "key": "af8ddd35195e9dc500b9a6f799f6f5c93d89193b",
524 "secret": "08a9dc6db3d7b53e1acebd9275677f4b0a04f1a5",
525 ...
526}
527```
528
529You should also make sure to read the [Exchanges](exchanges.md) section of the documentation to be aware of potential configuration details specific to your exchange.
530
531### Using proxy with Freqtrade
532
533To use a proxy with freqtrade, add the kwarg `"aiohttp_trust_env"=true` to the `"ccxt_async_kwargs"` dict in the exchange section of the configuration.
534
535An example for this can be found in `config_full.json.example`
536
537``` json
538"ccxt_async_config": {
539 "aiohttp_trust_env": true
540}
541```
542
543Then, export your proxy settings using the variables `"HTTP_PROXY"` and `"HTTPS_PROXY"` set to the appropriate values
544
545``` bash
546export HTTP_PROXY="http://addr:port"
547export HTTPS_PROXY="http://addr:port"
548freqtrade
549```
550
551## Next step
552
553Now you have configured your config.json, the next step is to [start your bot](bot-usage.md).