From d30aaaeaaa6f961fc24fda79c41e81204836a9d9 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 3 Dec 2021 14:27:04 +0100 Subject: [PATCH] Tests should also use CandleType --- freqtrade/enums/candletype.py | 2 +- tests/exchange/test_exchange.py | 4 ++-- tests/test_freqtradebot.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/freqtrade/enums/candletype.py b/freqtrade/enums/candletype.py index 9818bb67b..ade0f68d1 100644 --- a/freqtrade/enums/candletype.py +++ b/freqtrade/enums/candletype.py @@ -16,5 +16,5 @@ class CandleType(str, Enum): def from_string(cls, value: str) -> 'CandleType': if not value: # Default to spot - return CandleType.SPOT + return CandleType.SPOT_ return CandleType(value) diff --git a/tests/exchange/test_exchange.py b/tests/exchange/test_exchange.py index f1beedd84..0f1ba9869 100644 --- a/tests/exchange/test_exchange.py +++ b/tests/exchange/test_exchange.py @@ -11,7 +11,7 @@ import ccxt import pytest from pandas import DataFrame -from freqtrade.enums import Collateral, TradingMode +from freqtrade.enums import CandleType, Collateral, TradingMode from freqtrade.exceptions import (DDosProtection, DependencyException, InvalidOrderException, OperationalException, PricingError, TemporaryError) from freqtrade.exchange import Binance, Bittrex, Exchange, Kraken @@ -1685,7 +1685,7 @@ async def test__async_get_historic_ohlcv(default_conf, mocker, caplog, exchange_ pair = 'ETH/USDT' respair, restf, _, res = await exchange._async_get_historic_ohlcv( - pair, "5m", 1500000000000, is_new_pair=False) + pair, "5m", 1500000000000, candle_type=CandleType.SPOT, is_new_pair=False) assert respair == pair assert restf == '5m' # Call with very old timestamp - causes tons of requests diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index 283ffc234..127fc1d1f 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -11,7 +11,7 @@ import arrow import pytest from freqtrade.constants import CANCEL_REASON, MATH_CLOSE_PREC, UNLIMITED_STAKE_AMOUNT -from freqtrade.enums import RPCMessageType, RunMode, SellType, SignalDirection, State +from freqtrade.enums import CandleType, RPCMessageType, RunMode, SellType, SignalDirection, State from freqtrade.exceptions import (DependencyException, ExchangeError, InsufficientFundsError, InvalidOrderException, OperationalException, PricingError, TemporaryError) @@ -696,9 +696,9 @@ def test_process_informative_pairs_added(default_conf_usdt, ticker_usdt, mocker) freqtrade.process() assert inf_pairs.call_count == 1 assert refresh_mock.call_count == 1 - assert ("BTC/ETH", "1m", '') in refresh_mock.call_args[0][0] - assert ("ETH/USDT", "1h", '') in refresh_mock.call_args[0][0] - assert ("ETH/USDT", default_conf_usdt["timeframe"], '') in refresh_mock.call_args[0][0] + assert ("BTC/ETH", "1m", CandleType.SPOT_) in refresh_mock.call_args[0][0] + assert ("ETH/USDT", "1h", CandleType.SPOT_) in refresh_mock.call_args[0][0] + assert ("ETH/USDT", default_conf_usdt["timeframe"], CandleType.SPOT) in refresh_mock.call_args[0][0] @pytest.mark.parametrize("trading_mode", [