Don't suppport <1m timeframes

This commit is contained in:
Matthias 2020-01-11 11:36:28 +01:00
parent 5faebad863
commit 235a10ab86
2 changed files with 16 additions and 3 deletions

View File

@ -319,6 +319,10 @@ class Exchange:
raise OperationalException(
f"Invalid ticker interval '{timeframe}'. This exchange supports: {self.timeframes}")
if timeframe_to_minutes(timeframe) < 1:
raise OperationalException(
f"Timeframes < 1m are currently not supported by Freqtrade.")
def validate_ordertypes(self, order_types: Dict) -> None:
"""
Checks if order-types configured in strategy/config are supported

View File

@ -377,8 +377,11 @@ def test_validate_pairs_restricted(default_conf, mocker, caplog):
f"on the exchange and eventually remove XRP/BTC from your whitelist.", caplog)
def test_validate_timeframes(default_conf, mocker):
default_conf["ticker_interval"] = "5m"
@pytest.mark.parametrize("timeframe", [
('5m'), ("1m"), ("15m"), ("1h")
])
def test_validate_timeframes(default_conf, mocker, timeframe):
default_conf["ticker_interval"] = timeframe
api_mock = MagicMock()
id_mock = PropertyMock(return_value='test_exchange')
type(api_mock).id = id_mock
@ -399,7 +402,8 @@ def test_validate_timeframes_failed(default_conf, mocker):
api_mock = MagicMock()
id_mock = PropertyMock(return_value='test_exchange')
type(api_mock).id = id_mock
timeframes = PropertyMock(return_value={'1m': '1m',
timeframes = PropertyMock(return_value={'15s': '15s',
'1m': '1m',
'5m': '5m',
'15m': '15m',
'1h': '1h'})
@ -411,6 +415,11 @@ def test_validate_timeframes_failed(default_conf, mocker):
with pytest.raises(OperationalException,
match=r"Invalid ticker interval '3m'. This exchange supports.*"):
Exchange(default_conf)
default_conf["ticker_interval"] = "15s"
with pytest.raises(OperationalException,
match=r"Timeframes < 1m are currently not supported by Freqtrade."):
Exchange(default_conf)
def test_validate_timeframes_emulated_ohlcv_1(default_conf, mocker):