Rename PricingException to PricingError

This commit is contained in:
Matthias 2020-05-26 20:35:11 +02:00
parent 16cd1f06b2
commit 8c87fcdae3
3 changed files with 9 additions and 9 deletions

View File

@ -21,7 +21,7 @@ class DependencyException(FreqtradeException):
"""
class PricingException(DependencyException):
class PricingError(DependencyException):
"""
Subclass of DependencyException.
Indicates that the price could not be determined.

View File

@ -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}")

View File

@ -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)