add the filter to docs, tyding up the py file

This commit is contained in:
Stefano 2023-09-15 11:34:56 +09:00
parent 383bdb7d56
commit c19fe95d39
3 changed files with 15 additions and 11 deletions

View File

@ -70,6 +70,7 @@
},
"pairlists": [
{"method": "StaticPairList"},
{"method": "FullTradesFilter"},
{
"method": "VolumePairList",
"number_assets": 20,

View File

@ -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.

View File

@ -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']