price_last_balance renaming

This commit is contained in:
Matthias
2022-03-28 19:48:45 +02:00
parent d7c6520268
commit 2d740230f7
16 changed files with 50 additions and 33 deletions

View File

@@ -420,7 +420,7 @@ def get_default_conf(testdatadir):
"exit": 30
},
"entry_pricing": {
"ask_last_balance": 0.0,
"price_last_balance": 0.0,
"use_order_book": False,
"order_book_top": 1,
"check_depth_of_market": {

View File

@@ -2283,7 +2283,7 @@ def test_fetch_l2_order_book_exception(default_conf, mocker, exchange_name):
('ask', 20, 19, 10, 0.3, 17), # Between ask and last
('ask', 5, 6, 10, 1.0, 5), # last bigger than ask
('ask', 5, 6, 10, 0.5, 5), # last bigger than ask
('ask', 20, 19, 10, None, 20), # ask_last_balance missing
('ask', 20, 19, 10, None, 20), # price_last_balance missing
('ask', 10, 20, None, 0.5, 10), # last not available - uses ask
('ask', 4, 5, None, 0.5, 4), # last not available - uses ask
('ask', 4, 5, None, 1, 4), # last not available - uses ask
@@ -2294,7 +2294,7 @@ def test_fetch_l2_order_book_exception(default_conf, mocker, exchange_name):
('bid', 21, 20, 10, 0.7, 13), # Between bid and last
('bid', 21, 20, 10, 0.3, 17), # Between bid and last
('bid', 6, 5, 10, 1.0, 5), # last bigger than bid
('bid', 21, 20, 10, None, 20), # ask_last_balance missing
('bid', 21, 20, 10, None, 20), # price_last_balance missing
('bid', 6, 5, 10, 0.5, 5), # last bigger than bid
('bid', 21, 20, None, 0.5, 20), # last not available - uses bid
('bid', 6, 5, None, 0.5, 5), # last not available - uses bid
@@ -2305,9 +2305,9 @@ def test_get_entry_rate(mocker, default_conf, caplog, side, ask, bid,
last, last_ab, expected) -> None:
caplog.set_level(logging.DEBUG)
if last_ab is None:
del default_conf['entry_pricing']['ask_last_balance']
del default_conf['entry_pricing']['price_last_balance']
else:
default_conf['entry_pricing']['ask_last_balance'] = last_ab
default_conf['entry_pricing']['price_last_balance'] = last_ab
default_conf['entry_pricing']['price_side'] = side
exchange = get_patched_exchange(mocker, default_conf)
mocker.patch('freqtrade.exchange.Exchange.fetch_ticker',
@@ -2351,7 +2351,7 @@ def test_get_exit_rate(default_conf, mocker, caplog, side, bid, ask,
default_conf['exit_pricing']['price_side'] = side
if last_ab is not None:
default_conf['exit_pricing']['bid_last_balance'] = last_ab
default_conf['exit_pricing']['price_last_balance'] = last_ab
mocker.patch('freqtrade.exchange.Exchange.fetch_ticker',
return_value={'ask': ask, 'bid': bid, 'last': last})
pair = "ETH/BTC"
@@ -2381,10 +2381,10 @@ def test_get_exit_rate(default_conf, mocker, caplog, side, bid, ask,
def test_get_ticker_rate_error(mocker, entry, default_conf, caplog, side, is_short, ask, bid,
last, last_ab, expected) -> None:
caplog.set_level(logging.DEBUG)
default_conf['entry_pricing']['ask_last_balance'] = last_ab
default_conf['entry_pricing']['price_last_balance'] = last_ab
default_conf['entry_pricing']['price_side'] = side
default_conf['exit_pricing']['price_side'] = side
default_conf['exit_pricing']['ask_last_balance'] = last_ab
default_conf['exit_pricing']['price_last_balance'] = last_ab
exchange = get_patched_exchange(mocker, default_conf)
mocker.patch('freqtrade.exchange.Exchange.fetch_ticker',
return_value={'ask': ask, 'last': last, 'bid': bid})

View File

@@ -1031,10 +1031,12 @@ def test__validate_pricing_rules(default_conf, caplog) -> None:
def_conf['ask_strategy'] = {
'price_side': 'ask',
'use_order_book': True,
'bid_last_balance': 0.5
}
def_conf['bid_strategy'] = {
'price_side': 'bid',
'use_order_book': False,
'ask_last_balance': 0.7
}
conf = deepcopy(def_conf)
@@ -1043,8 +1045,10 @@ def test__validate_pricing_rules(default_conf, caplog) -> None:
r"DEPRECATED: Using 'ask_strategy' and 'bid_strategy' is.*", caplog)
assert conf['exit_pricing']['price_side'] == 'ask'
assert conf['exit_pricing']['use_order_book'] is True
assert conf['exit_pricing']['price_last_balance'] == 0.5
assert conf['entry_pricing']['price_side'] == 'bid'
assert conf['entry_pricing']['use_order_book'] is False
assert conf['entry_pricing']['price_last_balance'] == 0.7
assert 'ask_strategy' not in conf
assert 'bid_strategy' not in conf

View File

@@ -4491,7 +4491,7 @@ def test_order_book_entry_pricing1(mocker, default_conf_usdt, order_book_l2, exc
default_conf_usdt['exchange']['name'] = 'binance'
default_conf_usdt['entry_pricing']['use_order_book'] = True
default_conf_usdt['entry_pricing']['order_book_top'] = order_book_top
default_conf_usdt['entry_pricing']['ask_last_balance'] = 0
default_conf_usdt['entry_pricing']['price_last_balance'] = 0
default_conf_usdt['telegram']['enabled'] = False
freqtrade = FreqtradeBot(default_conf_usdt)