resolves freqtrade/freqtrade#4650
This commit is contained in:
parent
9089323d26
commit
9772a93634
@ -16,7 +16,6 @@ from freqtrade.misc import plural
|
|||||||
from freqtrade.plugins.pairlist.IPairList import IPairList
|
from freqtrade.plugins.pairlist.IPairList import IPairList
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -58,7 +57,8 @@ class VolatilityFilter(IPairList):
|
|||||||
Short whitelist method description - used for startup-messages
|
Short whitelist method description - used for startup-messages
|
||||||
"""
|
"""
|
||||||
return (f"{self.name} - Filtering pairs with volatility range "
|
return (f"{self.name} - Filtering pairs with volatility range "
|
||||||
f"{self._min_volatility}-{self._max_volatility} the last {self._days} {plural(self._days, 'day')}.")
|
f"{self._min_volatility}-{self._max_volatility} "
|
||||||
|
f" the last {self._days} {plural(self._days, 'day')}.")
|
||||||
|
|
||||||
def filter_pairlist(self, pairlist: List[str], tickers: Dict) -> List[str]:
|
def filter_pairlist(self, pairlist: List[str], tickers: Dict) -> List[str]:
|
||||||
"""
|
"""
|
||||||
@ -118,4 +118,3 @@ class VolatilityFilter(IPairList):
|
|||||||
self._pair_cache[pair] = result
|
self._pair_cache[pair] = result
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
@ -419,7 +419,7 @@ def test_VolumePairList_whitelist_gen(mocker, whitelist_conf, shitcoinmarkets, t
|
|||||||
whitelist_conf['stake_currency'] = base_currency
|
whitelist_conf['stake_currency'] = base_currency
|
||||||
|
|
||||||
ohlcv_history_high_vola = ohlcv_history.copy()
|
ohlcv_history_high_vola = ohlcv_history.copy()
|
||||||
ohlcv_history_high_vola.loc[ohlcv_history_high_vola.index==1, 'close'] = 0.00090
|
ohlcv_history_high_vola.loc[ohlcv_history_high_vola.index == 1, 'close'] = 0.00090
|
||||||
|
|
||||||
ohlcv_data = {
|
ohlcv_data = {
|
||||||
('ETH/BTC', '1d'): ohlcv_history,
|
('ETH/BTC', '1d'): ohlcv_history,
|
||||||
@ -429,14 +429,11 @@ def test_VolumePairList_whitelist_gen(mocker, whitelist_conf, shitcoinmarkets, t
|
|||||||
('HOT/BTC', '1d'): ohlcv_history_high_vola,
|
('HOT/BTC', '1d'): ohlcv_history_high_vola,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mocker.patch('freqtrade.exchange.Exchange.exchange_has', MagicMock(return_value=True))
|
mocker.patch('freqtrade.exchange.Exchange.exchange_has', MagicMock(return_value=True))
|
||||||
|
|
||||||
if whitelist_result == 'static_in_the_middle':
|
if whitelist_result == 'static_in_the_middle':
|
||||||
with pytest.raises(OperationalException,
|
with pytest.raises(OperationalException,
|
||||||
match=r"StaticPairList can only be used in the first position "
|
match=r"StaticPairList only in the first position "
|
||||||
r"in the list of Pairlist Handlers."):
|
r"in the list of Pairlist Handlers."):
|
||||||
freqtrade = get_patched_freqtradebot(mocker, whitelist_conf)
|
freqtrade = get_patched_freqtradebot(mocker, whitelist_conf)
|
||||||
return
|
return
|
||||||
@ -500,6 +497,7 @@ def test_VolumePairList_whitelist_gen(mocker, whitelist_conf, shitcoinmarkets, t
|
|||||||
if pairlist["method"] == 'VolatilityFilter':
|
if pairlist["method"] == 'VolatilityFilter':
|
||||||
assert log_has_re(r'^Removed .* from whitelist, because volatility.*$', caplog)
|
assert log_has_re(r'^Removed .* from whitelist, because volatility.*$', caplog)
|
||||||
|
|
||||||
|
|
||||||
def test_PrecisionFilter_error(mocker, whitelist_conf) -> None:
|
def test_PrecisionFilter_error(mocker, whitelist_conf) -> None:
|
||||||
whitelist_conf['pairlists'] = [{"method": "StaticPairList"}, {"method": "PrecisionFilter"}]
|
whitelist_conf['pairlists'] = [{"method": "StaticPairList"}, {"method": "PrecisionFilter"}]
|
||||||
del whitelist_conf['stoploss']
|
del whitelist_conf['stoploss']
|
||||||
|
Loading…
Reference in New Issue
Block a user