mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-13 03:33:55 +00:00
Allow <1m timeframes for utility modes
This commit is contained in:
parent
67c3bad977
commit
ad121c19b0
|
@ -23,7 +23,7 @@ from freqtrade.constants import (DEFAULT_AMOUNT_RESERVE_PERCENT, NON_OPEN_EXCHAN
|
||||||
BuySell, Config, EntryExit, ExchangeConfig,
|
BuySell, Config, EntryExit, ExchangeConfig,
|
||||||
ListPairsWithTimeframes, MakerTaker, OBLiteral, PairWithTimeframe)
|
ListPairsWithTimeframes, MakerTaker, OBLiteral, PairWithTimeframe)
|
||||||
from freqtrade.data.converter import clean_ohlcv_dataframe, ohlcv_to_dataframe, trades_dict_to_list
|
from freqtrade.data.converter import clean_ohlcv_dataframe, ohlcv_to_dataframe, trades_dict_to_list
|
||||||
from freqtrade.enums import OPTIMIZE_MODES, CandleType, MarginMode, PriceType, TradingMode
|
from freqtrade.enums import OPTIMIZE_MODES, CandleType, MarginMode, PriceType, RunMode, TradingMode
|
||||||
from freqtrade.exceptions import (DDosProtection, ExchangeError, InsufficientFundsError,
|
from freqtrade.exceptions import (DDosProtection, ExchangeError, InsufficientFundsError,
|
||||||
InvalidOrderException, OperationalException, PricingError,
|
InvalidOrderException, OperationalException, PricingError,
|
||||||
RetryableOrderError, TemporaryError)
|
RetryableOrderError, TemporaryError)
|
||||||
|
@ -595,7 +595,11 @@ class Exchange:
|
||||||
raise OperationalException(
|
raise OperationalException(
|
||||||
f"Invalid timeframe '{timeframe}'. This exchange supports: {self.timeframes}")
|
f"Invalid timeframe '{timeframe}'. This exchange supports: {self.timeframes}")
|
||||||
|
|
||||||
if timeframe and timeframe_to_minutes(timeframe) < 1:
|
if (
|
||||||
|
timeframe
|
||||||
|
and self._config['runmode'] != RunMode.UTIL_EXCHANGE
|
||||||
|
and timeframe_to_minutes(timeframe) < 1
|
||||||
|
):
|
||||||
raise OperationalException("Timeframes < 1m are currently not supported by Freqtrade.")
|
raise OperationalException("Timeframes < 1m are currently not supported by Freqtrade.")
|
||||||
|
|
||||||
def validate_ordertypes(self, order_types: Dict) -> None:
|
def validate_ordertypes(self, order_types: Dict) -> None:
|
||||||
|
|
|
@ -9,7 +9,7 @@ import ccxt
|
||||||
import pytest
|
import pytest
|
||||||
from pandas import DataFrame
|
from pandas import DataFrame
|
||||||
|
|
||||||
from freqtrade.enums import CandleType, MarginMode, TradingMode
|
from freqtrade.enums import CandleType, MarginMode, RunMode, TradingMode
|
||||||
from freqtrade.exceptions import (DDosProtection, DependencyException, ExchangeError,
|
from freqtrade.exceptions import (DDosProtection, DependencyException, ExchangeError,
|
||||||
InsufficientFundsError, InvalidOrderException,
|
InsufficientFundsError, InvalidOrderException,
|
||||||
OperationalException, PricingError, TemporaryError)
|
OperationalException, PricingError, TemporaryError)
|
||||||
|
@ -796,7 +796,9 @@ def test_validate_timeframes_failed(default_conf, mocker):
|
||||||
|
|
||||||
mocker.patch(f'{EXMS}._init_ccxt', MagicMock(return_value=api_mock))
|
mocker.patch(f'{EXMS}._init_ccxt', MagicMock(return_value=api_mock))
|
||||||
mocker.patch(f'{EXMS}._load_markets', MagicMock(return_value={}))
|
mocker.patch(f'{EXMS}._load_markets', MagicMock(return_value={}))
|
||||||
mocker.patch(f'{EXMS}.validate_pairs', MagicMock())
|
mocker.patch(f'{EXMS}.validate_pairs')
|
||||||
|
mocker.patch(f'{EXMS}.validate_stakecurrency')
|
||||||
|
mocker.patch(f'{EXMS}.validate_pricing')
|
||||||
with pytest.raises(OperationalException,
|
with pytest.raises(OperationalException,
|
||||||
match=r"Invalid timeframe '3m'. This exchange supports.*"):
|
match=r"Invalid timeframe '3m'. This exchange supports.*"):
|
||||||
Exchange(default_conf)
|
Exchange(default_conf)
|
||||||
|
@ -806,6 +808,10 @@ def test_validate_timeframes_failed(default_conf, mocker):
|
||||||
match=r"Timeframes < 1m are currently not supported by Freqtrade."):
|
match=r"Timeframes < 1m are currently not supported by Freqtrade."):
|
||||||
Exchange(default_conf)
|
Exchange(default_conf)
|
||||||
|
|
||||||
|
# Will not raise an exception in util mode.
|
||||||
|
default_conf['runmode'] = RunMode.UTIL_EXCHANGE
|
||||||
|
Exchange(default_conf)
|
||||||
|
|
||||||
|
|
||||||
def test_validate_timeframes_emulated_ohlcv_1(default_conf, mocker):
|
def test_validate_timeframes_emulated_ohlcv_1(default_conf, mocker):
|
||||||
default_conf["timeframe"] = "3m"
|
default_conf["timeframe"] = "3m"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user