From 8c87fcdae349baf422c0d490cd882ae81aa5cb8d Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 26 May 2020 20:35:11 +0200 Subject: [PATCH] Rename PricingException to PricingError --- freqtrade/exceptions.py | 2 +- freqtrade/freqtradebot.py | 8 ++++---- tests/test_freqtradebot.py | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/freqtrade/exceptions.py b/freqtrade/exceptions.py index 52209c47e..7cfed87e8 100644 --- a/freqtrade/exceptions.py +++ b/freqtrade/exceptions.py @@ -21,7 +21,7 @@ class DependencyException(FreqtradeException): """ -class PricingException(DependencyException): +class PricingError(DependencyException): """ Subclass of DependencyException. Indicates that the price could not be determined. diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 285784764..ffee1a010 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -18,7 +18,7 @@ from freqtrade.configuration import validate_config_consistency from freqtrade.data.converter import order_book_to_dataframe from freqtrade.data.dataprovider import DataProvider from freqtrade.edge import Edge -from freqtrade.exceptions import DependencyException, InvalidOrderException, PricingException +from freqtrade.exceptions import DependencyException, InvalidOrderException, PricingError from freqtrade.exchange import timeframe_to_minutes, timeframe_to_next_date from freqtrade.misc import safe_value_fallback from freqtrade.pairlist.pairlistmanager import PairListManager @@ -270,7 +270,7 @@ class FreqtradeBot: "Buy Price from orderbook could not be determined." f"Orderbook: {order_book}" ) - raise PricingException from e + raise PricingError from e logger.info(f'...top {order_book_top} order book buy rate {rate_from_l2:.8f}') used_rate = rate_from_l2 else: @@ -675,7 +675,7 @@ class FreqtradeBot: logger.warning( f"Sell Price at location from orderbook could not be determined." ) - raise PricingException from e + raise PricingError from e else: rate = self.exchange.fetch_ticker(pair)[ask_strategy['price_side']] self._sell_rate_cache[pair] = rate @@ -718,7 +718,7 @@ class FreqtradeBot: logger.warning( f"Sell Price at location {i} from orderbook could not be determined." ) - raise PricingException from e + raise PricingError from e logger.debug(f" order book {config_ask_strategy['price_side']} top {i}: " f"{sell_rate:0.8f}") diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index 110f122f1..5e951b585 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -14,7 +14,7 @@ import requests from freqtrade.constants import (CANCEL_REASON, MATH_CLOSE_PREC, UNLIMITED_STAKE_AMOUNT) from freqtrade.exceptions import (DependencyException, InvalidOrderException, - OperationalException, PricingException, + OperationalException, PricingError, TemporaryError) from freqtrade.freqtradebot import FreqtradeBot from freqtrade.persistence import Trade @@ -3792,7 +3792,7 @@ def test_order_book_bid_strategy_exception(mocker, default_conf, caplog) -> None freqtrade = FreqtradeBot(default_conf) # orderbook shall be used even if tickers would be lower. - with pytest.raises(PricingException): + with pytest.raises(PricingError): freqtrade.get_buy_rate('ETH/BTC', refresh=True) assert log_has_re(r'Buy Price from orderbook could not be determined.', caplog) @@ -3860,7 +3860,7 @@ def test_order_book_ask_strategy(default_conf, limit_buy_order, limit_sell_order mocker.patch('freqtrade.exchange.Exchange.fetch_l2_order_book', return_value={'bids': [[]], 'asks': [[]]}) - with pytest.raises(PricingException): + with pytest.raises(PricingError): freqtrade.handle_trade(trade) assert log_has('Sell Price at location 1 from orderbook could not be determined.', caplog) @@ -3926,7 +3926,7 @@ def test_get_sell_rate_orderbook_exception(default_conf, mocker, caplog): mocker.patch('freqtrade.exchange.Exchange.fetch_l2_order_book', return_value={'bids': [[]], 'asks': [[]]}) ft = get_patched_freqtradebot(mocker, default_conf) - with pytest.raises(PricingException): + with pytest.raises(PricingError): ft.get_sell_rate(pair, True) assert log_has("Sell Price at location from orderbook could not be determined.", caplog)