Rename "shuffle" parameter to "shuffle_freq"

This commit is contained in:
Matthias 2022-10-30 09:48:55 +01:00
parent a323acf343
commit 5013351143
2 changed files with 5 additions and 5 deletions

View File

@ -287,12 +287,12 @@ Min price precision for SHITCOIN/BTC is 8 decimals. If its price is 0.00000011 -
Shuffles (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. Shuffles (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.
By default, ShuffleFilter will shuffle pairs once per candle. By default, ShuffleFilter will shuffle pairs once per candle.
To shuffle on every iteration, set `"shuffle"` to `"iteration"` instead of the default of `"candle"`. To shuffle on every iteration, set `"shuffle_frequency"` to `"iteration"` instead of the default of `"candle"`.
``` json ``` json
{ {
"method": "ShuffleFilter", "method": "ShuffleFilter",
"shuffle": "candle", "shuffle_frequency": "candle",
"seed": 42 "seed": 42
} }

View File

@ -35,7 +35,7 @@ class ShuffleFilter(IPairList):
logger.info(f"Backtesting mode detected, applying seed value: {self._seed}") logger.info(f"Backtesting mode detected, applying seed value: {self._seed}")
self._random = random.Random(self._seed) self._random = random.Random(self._seed)
self._shuffle: ShuffleValues = pairlistconfig.get('shuffle', 'candle') self._shuffle_freq: ShuffleValues = pairlistconfig.get('shuffle_frequency', 'candle')
self.__pairlist_cache = PeriodicCache( self.__pairlist_cache = PeriodicCache(
maxsize=1000, ttl=timeframe_to_seconds(self._config['timeframe'])) maxsize=1000, ttl=timeframe_to_seconds(self._config['timeframe']))
@ -52,7 +52,7 @@ class ShuffleFilter(IPairList):
""" """
Short whitelist method description - used for startup-messages Short whitelist method description - used for startup-messages
""" """
return (f"{self.name} - Shuffling pairs every {self._shuffle}" + return (f"{self.name} - Shuffling pairs every {self._shuffle_freq}" +
(f", seed = {self._seed}." if self._seed is not None else ".")) (f", seed = {self._seed}." if self._seed is not None else "."))
def filter_pairlist(self, pairlist: List[str], tickers: Tickers) -> List[str]: def filter_pairlist(self, pairlist: List[str], tickers: Tickers) -> List[str]:
@ -65,7 +65,7 @@ class ShuffleFilter(IPairList):
""" """
pairlist_bef = tuple(pairlist) pairlist_bef = tuple(pairlist)
pairlist_new = self.__pairlist_cache.get(pairlist_bef) pairlist_new = self.__pairlist_cache.get(pairlist_bef)
if pairlist_new and self._shuffle == 'candle': if pairlist_new and self._shuffle_freq == 'candle':
# Use cached pairlist. # Use cached pairlist.
return pairlist_new return pairlist_new
# Shuffle is done inplace # Shuffle is done inplace