Added candle_type to a lot of methods, wrote some tests
This commit is contained in:
@@ -72,7 +72,7 @@ class AgeFilter(IPairList):
|
||||
:return: new allowlist
|
||||
"""
|
||||
needed_pairs = [
|
||||
(p, '1d') for p in pairlist
|
||||
(p, '1d', '') for p in pairlist
|
||||
if p not in self._symbolsChecked and p not in self._symbolsCheckFailed]
|
||||
if not needed_pairs:
|
||||
# Remove pairs that have been removed before
|
||||
@@ -88,7 +88,7 @@ class AgeFilter(IPairList):
|
||||
candles = self._exchange.refresh_latest_ohlcv(needed_pairs, since_ms=since_ms, cache=False)
|
||||
if self._enabled:
|
||||
for p in deepcopy(pairlist):
|
||||
daily_candles = candles[(p, '1d')] if (p, '1d') in candles else None
|
||||
daily_candles = candles[(p, '1d', '')] if (p, '1d', '') in candles else None
|
||||
if not self._validate_pair_loc(p, daily_candles):
|
||||
pairlist.remove(p)
|
||||
self.log_once(f"Validated {len(pairlist)} pairs.", logger.info)
|
||||
|
@@ -67,7 +67,7 @@ class VolatilityFilter(IPairList):
|
||||
:param tickers: Tickers (from exchange.get_tickers()). May be cached.
|
||||
:return: new allowlist
|
||||
"""
|
||||
needed_pairs = [(p, '1d') for p in pairlist if p not in self._pair_cache]
|
||||
needed_pairs = [(p, '1d', '') for p in pairlist if p not in self._pair_cache]
|
||||
|
||||
since_ms = (arrow.utcnow()
|
||||
.floor('day')
|
||||
@@ -81,7 +81,7 @@ class VolatilityFilter(IPairList):
|
||||
|
||||
if self._enabled:
|
||||
for p in deepcopy(pairlist):
|
||||
daily_candles = candles[(p, '1d')] if (p, '1d') in candles else None
|
||||
daily_candles = candles[(p, '1d', '')] if (p, '1d', '') in candles else None
|
||||
if not self._validate_pair_loc(p, daily_candles):
|
||||
pairlist.remove(p)
|
||||
return pairlist
|
||||
|
@@ -160,10 +160,9 @@ class VolumePairList(IPairList):
|
||||
f"{self._lookback_timeframe}, starting from {format_ms_time(since_ms)} "
|
||||
f"till {format_ms_time(to_ms)}", logger.info)
|
||||
needed_pairs = [
|
||||
(p, self._lookback_timeframe) for p in
|
||||
[
|
||||
s['symbol'] for s in filtered_tickers
|
||||
] if p not in self._pair_cache
|
||||
(p, self._lookback_timeframe, '') for p in
|
||||
[s['symbol'] for s in filtered_tickers]
|
||||
if p not in self._pair_cache
|
||||
]
|
||||
|
||||
# Get all candles
|
||||
@@ -174,8 +173,8 @@ class VolumePairList(IPairList):
|
||||
)
|
||||
for i, p in enumerate(filtered_tickers):
|
||||
pair_candles = candles[
|
||||
(p['symbol'], self._lookback_timeframe)
|
||||
] if (p['symbol'], self._lookback_timeframe) in candles else None
|
||||
(p['symbol'], self._lookback_timeframe, '')
|
||||
] if (p['symbol'], self._lookback_timeframe, '') 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:
|
||||
pair_candles['typical_price'] = (pair_candles['high'] + pair_candles['low']
|
||||
|
@@ -65,7 +65,7 @@ class RangeStabilityFilter(IPairList):
|
||||
:param tickers: Tickers (from exchange.get_tickers()). May be cached.
|
||||
:return: new allowlist
|
||||
"""
|
||||
needed_pairs = [(p, '1d') for p in pairlist if p not in self._pair_cache]
|
||||
needed_pairs = [(p, '1d', '') for p in pairlist if p not in self._pair_cache]
|
||||
|
||||
since_ms = (arrow.utcnow()
|
||||
.floor('day')
|
||||
@@ -79,7 +79,7 @@ class RangeStabilityFilter(IPairList):
|
||||
|
||||
if self._enabled:
|
||||
for p in deepcopy(pairlist):
|
||||
daily_candles = candles[(p, '1d')] if (p, '1d') in candles else None
|
||||
daily_candles = candles[(p, '1d', '')] if (p, '1d', '') in candles else None
|
||||
if not self._validate_pair_loc(p, daily_candles):
|
||||
pairlist.remove(p)
|
||||
return pairlist
|
||||
|
@@ -138,4 +138,4 @@ class PairListManager():
|
||||
"""
|
||||
Create list of pair tuples with (pair, timeframe)
|
||||
"""
|
||||
return [(pair, timeframe or self._config['timeframe']) for pair in pairs]
|
||||
return [(pair, timeframe or self._config['timeframe'], '') for pair in pairs]
|
||||
|
Reference in New Issue
Block a user