{"record":{"id":"db8fc1b952688feb","repo":"freqtrade/freqtrade","slug":"rangestabilityfilter-requires-sort-direction-to-be","errorCode":null,"errorMessage":"RangeStabilityFilter requires sort_direction to be either None (undefined), 'asc' or 'desc'","messagePattern":"RangeStabilityFilter requires sort_direction to be either None \\(undefined\\), 'asc' or 'desc'","errorType":"exception","errorClass":"OperationalException","httpStatus":null,"severity":"error","filePath":"freqtrade/plugins/pairlist/rangestabilityfilter.py","lineNumber":45,"sourceCode":"        self._days = self._pairlistconfig.get(\"lookback_days\", 10)\n        self._min_rate_of_change = self._pairlistconfig.get(\"min_rate_of_change\", 0.01)\n        self._max_rate_of_change = self._pairlistconfig.get(\"max_rate_of_change\")\n        self._refresh_period = self._pairlistconfig.get(\"refresh_period\", 86400)\n        self._def_candletype = self._config[\"candle_type_def\"]\n        self._sort_direction: str | None = self._pairlistconfig.get(\"sort_direction\", None)\n\n        self._pair_cache: FtTTLCache = FtTTLCache(maxsize=1000, ttl=self._refresh_period)\n\n        candle_limit = self._exchange.ohlcv_candle_limit(\"1d\", self._def_candletype)\n        if self._days < 1:\n            raise OperationalException(\"RangeStabilityFilter requires lookback_days to be >= 1\")\n        if self._days > candle_limit:\n            raise OperationalException(\n                \"RangeStabilityFilter requires lookback_days to not \"\n                f\"exceed exchange max request size ({candle_limit})\"\n            )\n        if self._sort_direction not in [None, \"asc\", \"desc\"]:\n            raise OperationalException(\n                \"RangeStabilityFilter requires sort_direction to be \"\n                \"either None (undefined), 'asc' or 'desc'\"\n            )\n\n    def short_desc(self) -> str:\n        \"\"\"\n        Short whitelist method description - used for startup-messages\n        \"\"\"\n        max_rate_desc = \"\"\n        if self._max_rate_of_change:\n            max_rate_desc = f\" and above {self._max_rate_of_change}\"\n        return (\n            f\"{self.name} - Filtering pairs with rate of change below \"\n            f\"{self._min_rate_of_change}{max_rate_desc} over the \"\n            f\"last {plural(self._days, 'day')}.\"\n        )\n\n    @staticmethod","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/freqtrade/freqtrade/blob/1c8edfe4d1e8d11bd4b40e8fc3237c26c3a60e15/freqtrade/plugins/pairlist/rangestabilityfilter.py#L27-L63","documentation":"RangeStabilityFilter raises this OperationalException when sort_direction is not None (unset), 'asc', or 'desc'. The setting optionally sorts the filtered pairs by their rate-of-change score.","triggerScenarios":"Pairlist config contains an invalid sort_direction string (e.g. 'ascending', 'ASC'). The check runs in __init__.","commonSituations":"Wrong wording or capitalization copied from forum posts or another filter's docs.","solutions":["Use exactly 'asc' or 'desc'","Omit sort_direction to keep the default undefined behavior"],"exampleFix":"# before\n{\"method\": \"RangeStabilityFilter\", \"config\": {\"sort_direction\": \"descending\"}}\n# after\n{\"method\": \"RangeStabilityFilter\", \"config\": {\"sort_direction\": \"desc\"}}","handlingStrategy":"type-guard","validationCode":"sd = pairlist_config.get(\"sort_direction\")\nif sd is not None and sd not in (\"asc\", \"desc\"):\n    raise ValueError(\"sort_direction must be None, 'asc' or 'desc'\")","typeGuard":"def is_valid_sort_direction(v: object) -> bool:\n    return v is None or (isinstance(v, str) and v in (\"asc\", \"desc\"))","tryCatchPattern":null,"preventionTips":["Use only lowercase 'asc'/'desc' or omit the key","Share one enum definition across filters and config validation"],"tags":["pairlist","config","validation"],"backgroundTag":null,"analyzedSha":"1c8edfe4d1e8d11bd4b40e8fc3237c26c3a60e15","analyzedAt":"2026-08-15T05:09:08.096Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}