Add explicit test for get_stop_limit_rate

This commit is contained in:
Matthias
2023-06-11 17:17:41 +02:00
parent fd940dbba2
commit 4a800fe467

View File

@@ -3489,6 +3489,19 @@ def test_stoploss_order_unsupported_exchange(default_conf, mocker):
exchange.stoploss_adjust(1, {}, side="sell")
@pytest.mark.parametrize('side,ratio,expected', [
('sell', 0.99, 99.0), # Default
('sell', 0.999, 99.9),
('buy', 0.99, 101.0), # Default
('buy', 0.999, 100.1),
])
def test__get_stop_limit_rate(default_conf_usdt, mocker, side, ratio, expected):
exchange = get_patched_exchange(mocker, default_conf_usdt, id='binance')
order_types = {'stoploss_on_exchange_limit_ratio': ratio}
assert exchange._get_stop_limit_rate(100, order_types, side) == expected
def test_merge_ft_has_dict(default_conf, mocker):
mocker.patch.multiple(EXMS,
_init_ccxt=MagicMock(return_value=MagicMock()),