diff --git a/config_examples/config_full.example.json b/config_examples/config_full.example.json index 4681ec7df..cb2d4797e 100644 --- a/config_examples/config_full.example.json +++ b/config_examples/config_full.example.json @@ -70,6 +70,7 @@ }, "pairlists": [ {"method": "StaticPairList"}, + {"method": "FullTradesFilter"}, { "method": "VolumePairList", "number_assets": 20, diff --git a/docs/includes/pairlists.md b/docs/includes/pairlists.md index 9cdcc9bca..83c913ab4 100644 --- a/docs/includes/pairlists.md +++ b/docs/includes/pairlists.md @@ -25,6 +25,7 @@ You may also use something like `.*DOWN/BTC` or `.*UP/BTC` to exclude leveraged * [`ProducerPairList`](#producerpairlist) * [`RemotePairList`](#remotepairlist) * [`AgeFilter`](#agefilter) +* [`FullTradesFilter`](#fulltradesfilter) * [`OffsetFilter`](#offsetfilter) * [`PerformanceFilter`](#performancefilter) * [`PrecisionFilter`](#precisionfilter) @@ -236,6 +237,17 @@ be caught out buying before the pair has finished dropping in price. This filter allows freqtrade to ignore pairs until they have been listed for at least `min_days_listed` days and listed before `max_days_listed`. +#### FullTradesFilter + +Shrink whitelist to consist only in-trade pairs when the trade slots are full (when `max_open_trades` isn't being set to `-1` in the config). + +When the trade slots are full, there is no need to calculate indicators of the rest of the pairs (except informative pairs) since no new trade can be opened. By shrinking the whitelist to just the in-trade pairs, you can improve calculation speeds and reduce CPU usage. When a trade slot is free (either a trade is closed or `max_open_trades` value in config is increased), then the whitelist will return to normal state. + +When multiple pairlist filters are being used, it's recommended to put this filter at second position directly below the primary pairlist, so when the trade slots are full, the bot don't have to download data for the rest of the filters. + +!!! Warning "Backtesting" + `FullTradesFilter` does not support backtesting mode. + #### OffsetFilter Offsets an incoming pairlist by a given `offset` value. diff --git a/freqtrade/plugins/pairlist/FullTradesFilter.py b/freqtrade/plugins/pairlist/FullTradesFilter.py index 44a6074f2..376d0540e 100644 --- a/freqtrade/plugins/pairlist/FullTradesFilter.py +++ b/freqtrade/plugins/pairlist/FullTradesFilter.py @@ -1,5 +1,5 @@ """ -Performance pair list filter +Full trade slots pair list filter """ import logging from typing import Any, Dict, List @@ -20,9 +20,6 @@ class FullTradesFilter(IPairList): pairlist_pos: int) -> None: super().__init__(exchange, pairlistmanager, config, pairlistconfig, pairlist_pos) - # self._minutes = pairlistconfig.get('minutes', 0) - # self._min_profit = pairlistconfig.get('min_profit') - @property def needstickers(self) -> bool: """ @@ -42,12 +39,6 @@ class FullTradesFilter(IPairList): def description() -> str: return "Shrink whitelist when trade slots are full." - @staticmethod - def available_parameters() -> Dict[str, PairlistParameter]: - return { - - } - def filter_pairlist(self, pairlist: List[str], tickers: Tickers) -> List[str]: """ Filters and sorts pairlist and returns the allowlist again. @@ -56,7 +47,7 @@ class FullTradesFilter(IPairList): :param tickers: Tickers (from exchange.get_tickers). May be cached. :return: new allowlist """ - # Get the trading performance for pairs from database + # Get the number of open trades and max open trades config num_open = Trade.get_open_trade_count() max_trades = self._config['max_open_trades']