Elffuss BraidHub

kikocis/freqtrade public

develop · 11.1 KiBRenderedRawPermalink
1## Pairlists and Pairlist Handlers
2
3Pairlist Handlers define the list of pairs (pairlist) that the bot should trade. They are configured in the `pairlists` section of the configuration settings.
4
5In your configuration, you can use Static Pairlist (defined by the [`StaticPairList`](#static-pair-list) Pairlist Handler) and Dynamic Pairlist (defined by the [`VolumePairList`](#volume-pair-list) Pairlist Handler).
6
7Additionally, [`AgeFilter`](#agefilter), [`PrecisionFilter`](#precisionfilter), [`PriceFilter`](#pricefilter), [`ShuffleFilter`](#shufflefilter), [`SpreadFilter`](#spreadfilter) and [`VolatilityFilter`](#volatilityfilter) act as Pairlist Filters, removing certain pairs and/or moving their positions in the pairlist.
8
9If multiple Pairlist Handlers are used, they are chained and a combination of all Pairlist Handlers forms the resulting pairlist the bot uses for trading and backtesting. Pairlist Handlers are executed in the sequence they are configured. You should always configure either `StaticPairList` or `VolumePairList` as the starting Pairlist Handler.
10
11Inactive markets are always removed from the resulting pairlist. Explicitly blacklisted pairs (those in the `pair_blacklist` configuration setting) are also always removed from the resulting pairlist.
12
13### Pair blacklist
14
15The pair blacklist (configured via `exchange.pair_blacklist` in the configuration) disallows certain pairs from trading.
16This can be as simple as excluding `DOGE/BTC` - which will remove exactly this pair.
17
18The pair-blacklist does also support wildcards (in regex-style) - so `BNB/.*` will exclude ALL pairs that start with BNB.
19You may also use something like `.*DOWN/BTC` or `.*UP/BTC` to exclude leveraged tokens (check Pair naming conventions for your exchange!)
20
21### Available Pairlist Handlers
22
23* [`StaticPairList`](#static-pair-list) (default, if not configured differently)
24* [`VolumePairList`](#volume-pair-list)
25* [`AgeFilter`](#agefilter)
26* [`PerformanceFilter`](#performancefilter)
27* [`PrecisionFilter`](#precisionfilter)
28* [`PriceFilter`](#pricefilter)
29* [`ShuffleFilter`](#shufflefilter)
30* [`SpreadFilter`](#spreadfilter)
31* [`RangeStabilityFilter`](#rangestabilityfilter)
32* [`VolatilityFilter`](#volatilityfilter)
33
34!!! Tip "Testing pairlists"
35 Pairlist configurations can be quite tricky to get right. Best use the [`test-pairlist`](utils.md#test-pairlist) utility sub-command to test your configuration quickly.
36
37#### Static Pair List
38
39By default, the `StaticPairList` method is used, which uses a statically defined pair whitelist from the configuration. The pairlist also supports wildcards (in regex-style) - so `.*/BTC` will include all pairs with BTC as a stake.
40
41It uses configuration from `exchange.pair_whitelist` and `exchange.pair_blacklist`.
42
43```json
44"pairlists": [
45 {"method": "StaticPairList"}
46 ],
47```
48
49By default, only currently enabled pairs are allowed.
50To skip pair validation against active markets, set `"allow_inactive": true` within the `StaticPairList` configuration.
51This can be useful for backtesting expired pairs (like quarterly spot-markets).
52This option must be configured along with `exchange.skip_pair_validation` in the exchange configuration.
53
54#### Volume Pair List
55
56`VolumePairList` employs sorting/filtering of pairs by their trading volume. It selects `number_assets` top pairs with sorting based on the `sort_key` (which can only be `quoteVolume`).
57
58When used in the chain of Pairlist Handlers in a non-leading position (after StaticPairList and other Pairlist Filters), `VolumePairList` considers outputs of previous Pairlist Handlers, adding its sorting/selection of the pairs by the trading volume.
59
60When used on the leading position of the chain of Pairlist Handlers, it does not consider `pair_whitelist` configuration setting, but selects the top assets from all available markets (with matching stake-currency) on the exchange.
61
62The `refresh_period` setting allows to define the period (in seconds), at which the pairlist will be refreshed. Defaults to 1800s (30 minutes).
63The pairlist cache (`refresh_period`) on `VolumePairList` is only applicable to generating pairlists.
64Filtering instances (not the first position in the list) will not apply any cache and will always use up-to-date data.
65
66`VolumePairList` is based on the ticker data from exchange, as reported by the ccxt library:
67
68* The `quoteVolume` is the amount of quote (stake) currency traded (bought or sold) in last 24 hours.
69
70```json
71"pairlists": [{
72 "method": "VolumePairList",
73 "number_assets": 20,
74 "sort_key": "quoteVolume",
75 "refresh_period": 1800
76}],
77```
78
79!!! Note
80 `VolumePairList` does not support backtesting mode.
81
82#### AgeFilter
83
84Removes pairs that have been listed on the exchange for less than `min_days_listed` days (defaults to `10`).
85
86When pairs are first listed on an exchange they can suffer huge price drops and volatility
87in the first few days while the pair goes through its price-discovery period. Bots can often
88be caught out buying before the pair has finished dropping in price.
89
90This filter allows freqtrade to ignore pairs until they have been listed for at least `min_days_listed` days.
91
92#### PerformanceFilter
93
94Sorts pairs by past trade performance, as follows:
95
961. Positive performance.
972. No closed trades yet.
983. Negative performance.
99
100Trade count is used as a tie breaker.
101
102!!! Note
103 `PerformanceFilter` does not support backtesting mode.
104
105#### PrecisionFilter
106
107Filters low-value coins which would not allow setting stoplosses.
108
109#### PriceFilter
110
111The `PriceFilter` allows filtering of pairs by price. Currently the following price filters are supported:
112
113* `min_price`
114* `max_price`
115* `low_price_ratio`
116
117The `min_price` setting removes pairs where the price is below the specified price. This is useful if you wish to avoid trading very low-priced pairs.
118This option is disabled by default, and will only apply if set to > 0.
119
120The `max_price` setting removes pairs where the price is above the specified price. This is useful if you wish to trade only low-priced pairs.
121This option is disabled by default, and will only apply if set to > 0.
122
123The `low_price_ratio` setting removes pairs where a raise of 1 price unit (pip) is above the `low_price_ratio` ratio.
124This option is disabled by default, and will only apply if set to > 0.
125
126For `PriceFiler` at least one of its `min_price`, `max_price` or `low_price_ratio` settings must be applied.
127
128Calculation example:
129
130Min price precision for SHITCOIN/BTC is 8 decimals. If its price is 0.00000011 - one price step above would be 0.00000012, which is ~9% higher than the previous price value. You may filter out this pair by using PriceFilter with `low_price_ratio` set to 0.09 (9%) or with `min_price` set to 0.00000011, correspondingly.
131
132!!! Warning "Low priced pairs"
133 Low priced pairs with high "1 pip movements" are dangerous since they are often illiquid and it may also be impossible to place the desired stoploss, which can often result in high losses since price needs to be rounded to the next tradable price - so instead of having a stoploss of -5%, you could end up with a stoploss of -9% simply due to price rounding.
134
135#### ShuffleFilter
136
137Shuffles (randomizes) pairs in the pairlist. It can be used for preventing the bot from trading some of the pairs more frequently then others when you want all pairs be treated with the same priority.
138
139!!! Tip
140 You may set the `seed` value for this Pairlist to obtain reproducible results, which can be useful for repeated backtesting sessions. If `seed` is not set, the pairs are shuffled in the non-repeatable random order.
141
142#### SpreadFilter
143
144Removes pairs that have a difference between asks and bids above the specified ratio, `max_spread_ratio` (defaults to `0.005`).
145
146Example:
147
148If `DOGE/BTC` maximum bid is 0.00000026 and minimum ask is 0.00000027, the ratio is calculated as: `1 - bid/ask ~= 0.037` which is `> 0.005` and this pair will be filtered out.
149
150#### RangeStabilityFilter
151
152Removes pairs where the difference between lowest low and highest high over `lookback_days` days is below `min_rate_of_change`. Since this is a filter that requires additional data, the results are cached for `refresh_period`.
153
154In the below example:
155If the trading range over the last 10 days is <1%, remove the pair from the whitelist.
156
157```json
158"pairlists": [
159 {
160 "method": "RangeStabilityFilter",
161 "lookback_days": 10,
162 "min_rate_of_change": 0.01,
163 "refresh_period": 1440
164 }
165]
166```
167
168!!! Tip
169 This Filter can be used to automatically remove stable coin pairs, which have a very low trading range, and are therefore extremely difficult to trade with profit.
170
171#### VolatilityFilter
172
173Volatility is the degree of historical variation of a pairs over time, is is measured by the standard deviation of logarithmic daily returns. Returns are assumed to be normally distributed, although actual distribution might be different. In a normal distribution, 68% of observations fall within one standard deviation and 95% of observations fall within two standard deviations. Assuming a volatility of 0.05 means that the expected returns for 20 out of 30 days is expected to be less than 5% (one standard deviation). Volatility is a positive ratio of the expected deviation of return and can be greater than 1.00. Please refer to the wikipedia definition of [`volatility`](https://en.wikipedia.org/wiki/Volatility_(finance)).
174
175This filter removes pairs if the average volatility over a `lookback_days` days is below `min_volatility` or above `max_volatility`. Since this is a filter that requires additional data, the results are cached for `refresh_period`.
176
177This filter can be used to narrow down your pairs to a certain volatility or avoid very volatile pairs.
178
179In the below example:
180If the volatility over the last 10 days is not in the range of 0.05-0.50, remove the pair from the whitelist. The filter is applied every 24h.
181
182```json
183"pairlists": [
184 {
185 "method": "VolatilityFilter",
186 "lookback_days": 10,
187 "min_volatility": 0.05,
188 "max_volatility": 0.50,
189 "refresh_period": 86400
190 }
191]
192```
193
194### Full example of Pairlist Handlers
195
196The below example blacklists `BNB/BTC`, uses `VolumePairList` with `20` assets, sorting pairs by `quoteVolume` and applies [`PrecisionFilter`](#precisionfilter) and [`PriceFilter`](#price-filter), filtering all assets where 1 price unit is > 1%. Then the [`SpreadFilter`](#spreadfilter) and [`VolatilityFilter`](#volatilityfilter) is applied and pairs are finally shuffled with the random seed set to some predefined value.
197
198```json
199"exchange": {
200 "pair_whitelist": [],
201 "pair_blacklist": ["BNB/BTC"]
202},
203"pairlists": [
204 {
205 "method": "VolumePairList",
206 "number_assets": 20,
207 "sort_key": "quoteVolume",
208 },
209 {"method": "AgeFilter", "min_days_listed": 10},
210 {"method": "PrecisionFilter"},
211 {"method": "PriceFilter", "low_price_ratio": 0.01},
212 {"method": "SpreadFilter", "max_spread_ratio": 0.005},
213 {
214 "method": "RangeStabilityFilter",
215 "lookback_days": 10,
216 "min_rate_of_change": 0.01,
217 "refresh_period": 1440
218 },
219 {
220 "method": "VolatilityFilter",
221 "lookback_days": 10,
222 "min_volatility": 0.05,
223 "max_volatility": 0.50,
224 "refresh_period": 86400
225 },
226 {"method": "ShuffleFilter", "seed": 42}
227 ],
228```