refactor
This commit is contained in:
@@ -159,6 +159,15 @@ def test_gen_pair_whitelist(mocker, default_conf, tickers) -> None:
|
||||
assert whitelist == []
|
||||
|
||||
|
||||
def test_gen_pair_whitelist_not_supported(mocker, default_conf, tickers) -> None:
|
||||
freqtrade = get_patched_freqtradebot(mocker, default_conf)
|
||||
mocker.patch('freqtrade.exchange.Exchange.get_tickers', tickers)
|
||||
mocker.patch('freqtrade.exchange.Exchange.exchange_has', MagicMock(return_value=False))
|
||||
|
||||
with pytest.raises(OperationalException):
|
||||
freqtrade._gen_pair_whitelist(base_currency='BTC')
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="Test not implemented")
|
||||
def test_refresh_whitelist() -> None:
|
||||
pass
|
||||
@@ -1914,6 +1923,7 @@ def test_order_book_depth_of_market(default_conf, ticker, limit_buy_order, fee,
|
||||
def test_order_book_depth_of_market_high_delta(default_conf, ticker,
|
||||
limit_buy_order, fee, markets, mocker):
|
||||
default_conf['experimental']['check_depth_of_market']['enabled'] = True
|
||||
# delta is 100 which is impossible to reach. hence check_depth_of_market will return false
|
||||
default_conf['experimental']['check_depth_of_market']['bids_to_ask_delta'] = 100
|
||||
patch_RPCManager(mocker)
|
||||
mocker.patch.multiple(
|
||||
@@ -1924,7 +1934,6 @@ def test_order_book_depth_of_market_high_delta(default_conf, ticker,
|
||||
get_fee=fee,
|
||||
get_markets=markets
|
||||
)
|
||||
|
||||
# Save state of current whitelist
|
||||
freqtrade = FreqtradeBot(default_conf)
|
||||
patch_get_signal(freqtrade)
|
||||
@@ -1934,33 +1943,47 @@ def test_order_book_depth_of_market_high_delta(default_conf, ticker,
|
||||
assert trade is None
|
||||
|
||||
|
||||
def test_order_book_bid_strategy(default_conf) -> None:
|
||||
def test_order_book_bid_strategy1(default_conf) -> None:
|
||||
"""
|
||||
test if function get_target_bid will return the order book price
|
||||
instead of the ask rate
|
||||
"""
|
||||
default_conf['exchange']['name'] = 'binance'
|
||||
default_conf['experimental']['bid_strategy']['use_order_book'] = True
|
||||
default_conf['experimental']['bid_strategy']['order_book_top'] = 2
|
||||
default_conf['bid_strategy']['ask_last_balance'] = 0
|
||||
default_conf['telegram']['enabled'] = False
|
||||
|
||||
freqtrade = FreqtradeBot(default_conf)
|
||||
assert freqtrade.get_target_bid('BTC/USDT', {'ask': 200000, 'last': 200000}) != 200000
|
||||
|
||||
|
||||
def test_order_book_bid_strategy2(default_conf) -> None:
|
||||
"""
|
||||
test if function get_target_bid will return ask rate instead
|
||||
of the order book rate
|
||||
"""
|
||||
default_conf['exchange']['name'] = 'binance'
|
||||
default_conf['experimental']['bid_strategy']['use_order_book'] = True
|
||||
default_conf['experimental']['bid_strategy']['order_book_top'] = 1
|
||||
default_conf['bid_strategy']['ask_last_balance'] = 0
|
||||
default_conf['telegram']['enabled'] = False
|
||||
|
||||
freqtrade = FreqtradeBot(default_conf)
|
||||
|
||||
assert freqtrade.get_target_bid('BTC/USDT', {'ask': 2, 'last': 2}) == 2
|
||||
|
||||
|
||||
def test_trunc_num(default_conf) -> None:
|
||||
default_conf['telegram']['enabled'] = False
|
||||
freqtrade = FreqtradeBot(default_conf)
|
||||
|
||||
assert freqtrade._trunc_num(10.1111, 2) == 10.11
|
||||
|
||||
|
||||
def test_check_depth_of_market_buy(default_conf) -> None:
|
||||
default_conf['telegram']['enabled'] = False
|
||||
default_conf['exchange']['name'] = 'binance'
|
||||
default_conf['experimental']['check_depth_of_market']['enabled'] = True
|
||||
# delta is 100 which is impossible to reach. hence function will return false
|
||||
default_conf['experimental']['check_depth_of_market']['bids_to_ask_delta'] = 100
|
||||
freqtrade = FreqtradeBot(default_conf)
|
||||
|
||||
assert freqtrade._check_depth_of_market_buy('ETH/BTC') is False
|
||||
conf = default_conf['experimental']['check_depth_of_market']
|
||||
assert freqtrade._check_depth_of_market_buy('ETH/BTC', conf) is False
|
||||
|
||||
|
||||
def test_order_book_ask_strategy(default_conf, limit_buy_order, limit_sell_order,
|
||||
|
Reference in New Issue
Block a user