Use candle_type_def
where possible
This commit is contained in:
@@ -10,7 +10,6 @@ from pandas import DataFrame
|
||||
|
||||
from freqtrade.configuration import PeriodicCache
|
||||
from freqtrade.constants import ListPairsWithTimeframes
|
||||
from freqtrade.enums import CandleType
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.misc import plural
|
||||
from freqtrade.plugins.pairlist.IPairList import IPairList
|
||||
@@ -74,7 +73,7 @@ class AgeFilter(IPairList):
|
||||
:return: new allowlist
|
||||
"""
|
||||
needed_pairs: ListPairsWithTimeframes = [
|
||||
(p, '1d', CandleType.SPOT_) for p in pairlist
|
||||
(p, '1d', self._config['candle_type_def']) 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
|
||||
@@ -90,8 +89,8 @@ 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', CandleType.SPOT_)] if (
|
||||
p, '1d', CandleType.SPOT_) in candles else None
|
||||
daily_candles = candles[(p, '1d', self._config['candle_type_def'])] if (
|
||||
p, '1d', self._config['candle_type_def']) 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)
|
||||
|
@@ -12,7 +12,6 @@ from cachetools.ttl import TTLCache
|
||||
from pandas import DataFrame
|
||||
|
||||
from freqtrade.constants import ListPairsWithTimeframes
|
||||
from freqtrade.enums import CandleType
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.misc import plural
|
||||
from freqtrade.plugins.pairlist.IPairList import IPairList
|
||||
@@ -70,7 +69,7 @@ class VolatilityFilter(IPairList):
|
||||
:return: new allowlist
|
||||
"""
|
||||
needed_pairs: ListPairsWithTimeframes = [
|
||||
(p, '1d', CandleType.SPOT_) for p in pairlist if p not in self._pair_cache]
|
||||
(p, '1d', self._config['candle_type_def']) for p in pairlist if p not in self._pair_cache]
|
||||
|
||||
since_ms = (arrow.utcnow()
|
||||
.floor('day')
|
||||
@@ -84,8 +83,8 @@ class VolatilityFilter(IPairList):
|
||||
|
||||
if self._enabled:
|
||||
for p in deepcopy(pairlist):
|
||||
daily_candles = candles[(p, '1d', CandleType.SPOT_)] if (
|
||||
p, '1d', CandleType.SPOT_) in candles else None
|
||||
daily_candles = candles[(p, '1d', self._config['candle_type_def'])] if (
|
||||
p, '1d', self._config['candle_type_def']) in candles else None
|
||||
if not self._validate_pair_loc(p, daily_candles):
|
||||
pairlist.remove(p)
|
||||
return pairlist
|
||||
|
@@ -11,7 +11,6 @@ import arrow
|
||||
from cachetools.ttl import TTLCache
|
||||
|
||||
from freqtrade.constants import ListPairsWithTimeframes
|
||||
from freqtrade.enums import CandleType
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.exchange import timeframe_to_minutes
|
||||
from freqtrade.misc import format_ms_time
|
||||
@@ -45,6 +44,7 @@ class VolumePairList(IPairList):
|
||||
self._lookback_days = self._pairlistconfig.get('lookback_days', 0)
|
||||
self._lookback_timeframe = self._pairlistconfig.get('lookback_timeframe', '1d')
|
||||
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):
|
||||
raise OperationalException(
|
||||
@@ -162,7 +162,7 @@ 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: ListPairsWithTimeframes = [
|
||||
(p, self._lookback_timeframe, CandleType.SPOT_) for p in
|
||||
(p, self._lookback_timeframe, self._def_candletype) for p in
|
||||
[s['symbol'] for s in filtered_tickers]
|
||||
if p not in self._pair_cache
|
||||
]
|
||||
@@ -175,8 +175,10 @@ class VolumePairList(IPairList):
|
||||
)
|
||||
for i, p in enumerate(filtered_tickers):
|
||||
pair_candles = candles[
|
||||
(p['symbol'], self._lookback_timeframe, CandleType.SPOT_)
|
||||
] if (p['symbol'], self._lookback_timeframe, CandleType.SPOT_) in candles else None
|
||||
(p['symbol'], self._lookback_timeframe, self._def_candletype)
|
||||
] if (
|
||||
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:
|
||||
pair_candles['typical_price'] = (pair_candles['high'] + pair_candles['low']
|
||||
|
@@ -10,7 +10,6 @@ from cachetools.ttl import TTLCache
|
||||
from pandas import DataFrame
|
||||
|
||||
from freqtrade.constants import ListPairsWithTimeframes
|
||||
from freqtrade.enums import CandleType
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.misc import plural
|
||||
from freqtrade.plugins.pairlist.IPairList import IPairList
|
||||
@@ -68,7 +67,7 @@ class RangeStabilityFilter(IPairList):
|
||||
:return: new allowlist
|
||||
"""
|
||||
needed_pairs: ListPairsWithTimeframes = [
|
||||
(p, '1d', CandleType.SPOT_) for p in pairlist if p not in self._pair_cache]
|
||||
(p, '1d', self._config['candle_type_def']) for p in pairlist if p not in self._pair_cache]
|
||||
|
||||
since_ms = (arrow.utcnow()
|
||||
.floor('day')
|
||||
@@ -82,8 +81,8 @@ class RangeStabilityFilter(IPairList):
|
||||
|
||||
if self._enabled:
|
||||
for p in deepcopy(pairlist):
|
||||
daily_candles = candles[(p, '1d', CandleType.SPOT_)] if (
|
||||
p, '1d', CandleType.SPOT_) in candles else None
|
||||
daily_candles = candles[(p, '1d', self._config['candle_type_def'])] if (
|
||||
p, '1d', self._config['candle_type_def']) in candles else None
|
||||
if not self._validate_pair_loc(p, daily_candles):
|
||||
pairlist.remove(p)
|
||||
return pairlist
|
||||
|
Reference in New Issue
Block a user