Removed "is not None"

https://stackoverflow.com/users/566644/lauritz-v-thaulow

freqtrade\configuration\configuration.py:461 reduced checks

freqtrade\persistence\trade_model.py:fee_updated - reduced code
This commit is contained in:
மனோஜ்குமார் பழனிச்சாமி
2022-05-18 03:27:18 +05:30
parent 7b9439f2e4
commit e7f15fb61f
48 changed files with 191 additions and 194 deletions

View File

@@ -108,7 +108,7 @@ class AgeFilter(IPairList):
if pair in self._symbolsChecked:
return True
if daily_candles is not None:
if daily_candles:
if (
len(daily_candles) >= self._min_days_listed
and (not self._max_days_listed or len(daily_candles) <= self._max_days_listed)

View File

@@ -70,7 +70,7 @@ class PerformanceFilter(IPairList):
sorted_df = list_df.merge(performance, on='pair', how='left')\
.fillna(0).sort_values(by=['count', 'prior_idx'], ascending=True)\
.sort_values(by=['profit_ratio'], ascending=False)
if self._min_profit is not None:
if self._min_profit:
removed = sorted_df[sorted_df['profit_ratio'] < self._min_profit]
for _, row in removed.iterrows():
self.log_once(

View File

@@ -90,7 +90,7 @@ class PriceFilter(IPairList):
price = ticker['last']
market = self._exchange.markets[pair]
limits = market['limits']
if (limits['amount']['min'] is not None):
if (limits['amount']['min']):
min_amount = limits['amount']['min']
min_precision = market['precision']['amount']

View File

@@ -44,7 +44,7 @@ class ShuffleFilter(IPairList):
Short whitelist method description - used for startup-messages
"""
return (f"{self.name} - Shuffling pairs" +
(f", seed = {self._seed}." if self._seed is not None else "."))
(f", seed = {self._seed}." if self._seed else "."))
def filter_pairlist(self, pairlist: List[str], tickers: Dict) -> List[str]:
"""

View File

@@ -99,11 +99,11 @@ class VolatilityFilter(IPairList):
"""
# Check symbol in cache
cached_res = self._pair_cache.get(pair, None)
if cached_res is not None:
if cached_res:
return cached_res
result = False
if daily_candles is not None and not daily_candles.empty:
if daily_candles and not daily_candles.empty:
returns = (np.log(daily_candles.close / daily_candles.close.shift(-1)))
returns.fillna(0, inplace=True)

View File

@@ -134,7 +134,7 @@ class VolumePairList(IPairList):
filtered_tickers = [
v for k, v in tickers.items()
if (self._exchange.get_pair_quote_currency(k) == self._stake_currency
and (self._use_range or v[self._sort_key] is not None)
and (self._use_range or v[self._sort_key])
and v['symbol'] in _pairlist)]
pairlist = [s['symbol'] for s in filtered_tickers]
else:
@@ -192,7 +192,7 @@ class VolumePairList(IPairList):
p['symbol'], self._lookback_timeframe, self._def_candletype
) in candles else None
# in case of candle data calculate typical price and quoteVolume for candle
if pair_candles is not None and not pair_candles.empty:
if pair_candles and not pair_candles.empty:
if self._exchange._ft_has["ohlcv_volume_currency"] == "base":
pair_candles['typical_price'] = (pair_candles['high'] + pair_candles['low']
+ pair_candles['close']) / 3

View File

@@ -97,11 +97,11 @@ class RangeStabilityFilter(IPairList):
"""
# Check symbol in cache
cached_res = self._pair_cache.get(pair, None)
if cached_res is not None:
if cached_res:
return cached_res
result = False
if daily_candles is not None and not daily_candles.empty:
if daily_candles and not daily_candles.empty:
highest_high = daily_candles['high'].max()
lowest_low = daily_candles['low'].min()
pct_change = ((highest_high - lowest_low) / lowest_low) if lowest_low > 0 else 0