chore: don't use bitwise comparisons for bool comparisons

This commit is contained in:
Matthias
2026-01-01 14:41:49 +01:00
parent 2a0da08413
commit 78dde7d1bc
2 changed files with 5 additions and 5 deletions

View File

@@ -53,7 +53,7 @@ class PercentChangePairList(IPairList):
self._sort_direction: str | None = self._pairlistconfig.get("sort_direction", "desc")
self._def_candletype = self._config["candle_type_def"]
if (self._lookback_days > 0) & (self._lookback_period > 0):
if (self._lookback_days > 0) and (self._lookback_period > 0):
raise OperationalException(
"Ambiguous configuration: lookback_days and lookback_period both set in pairlist "
"config. Please set lookback_days only or lookback_period and lookback_timeframe "
@@ -70,7 +70,7 @@ class PercentChangePairList(IPairList):
_tf_in_sec = self._tf_in_min * 60
# whether to use range lookback or not
self._use_range = (self._tf_in_min > 0) & (self._lookback_period > 0)
self._use_range = (self._tf_in_min > 0) and (self._lookback_period > 0)
if self._use_range & (self._refresh_period < _tf_in_sec):
raise OperationalException(

View File

@@ -47,7 +47,7 @@ class VolumePairList(IPairList):
self._lookback_period = self._pairlistconfig.get("lookback_period", 0)
self._def_candletype = self._config["candle_type_def"]
if (self._lookback_days > 0) & (self._lookback_period > 0):
if (self._lookback_days > 0) and (self._lookback_period > 0):
raise OperationalException(
"Ambiguous configuration: lookback_days and lookback_period both set in pairlist "
"config. Please set lookback_days only or lookback_period and lookback_timeframe "
@@ -64,9 +64,9 @@ class VolumePairList(IPairList):
_tf_in_sec = self._tf_in_min * 60
# whether to use range lookback or not
self._use_range = (self._tf_in_min > 0) & (self._lookback_period > 0)
self._use_range = (self._tf_in_min > 0) and (self._lookback_period > 0)
if self._use_range & (self._refresh_period < _tf_in_sec):
if self._use_range and (self._refresh_period < _tf_in_sec):
raise OperationalException(
f"Refresh period of {self._refresh_period} seconds is smaller than one "
f"timeframe of {self._lookback_timeframe}. Please adjust refresh_period "