|
|
|
|
@ -180,23 +180,31 @@ def test_get_trade_stake_amount_unlimited_amount(default_conf, ticker, balance_r
|
|
|
|
|
assert result == 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize('stake_amount,min_stake_amount,max_stake_amount,expected', [
|
|
|
|
|
(22, 11, 50, 22),
|
|
|
|
|
(100, 11, 500, 100),
|
|
|
|
|
(1000, 11, 500, 500), # Above max-stake
|
|
|
|
|
(20, 15, 10, 0), # Minimum stake > max-stake
|
|
|
|
|
(9, 11, 100, 11), # Below min stake
|
|
|
|
|
(1, 15, 10, 0), # Below min stake and min_stake > max_stake
|
|
|
|
|
(20, 50, 100, 0), # Below min stake and stake * 1.3 > min_stake
|
|
|
|
|
@pytest.mark.parametrize('stake_amount,min_stake,stake_available,max_stake,expected', [
|
|
|
|
|
(22, 11, 50, 10000, 22),
|
|
|
|
|
(100, 11, 500, 10000, 100),
|
|
|
|
|
(1000, 11, 500, 10000, 500), # Above stake_available
|
|
|
|
|
(700, 11, 1000, 400, 400), # Above max_stake, below stake available
|
|
|
|
|
(20, 15, 10, 10000, 0), # Minimum stake > stake_available
|
|
|
|
|
(9, 11, 100, 10000, 11), # Below min stake
|
|
|
|
|
(1, 15, 10, 10000, 0), # Below min stake and min_stake > stake_available
|
|
|
|
|
(20, 50, 100, 10000, 0), # Below min stake and stake * 1.3 > min_stake
|
|
|
|
|
|
|
|
|
|
])
|
|
|
|
|
def test_validate_stake_amount(mocker, default_conf,
|
|
|
|
|
stake_amount, min_stake_amount, max_stake_amount, expected):
|
|
|
|
|
def test_validate_stake_amount(
|
|
|
|
|
mocker,
|
|
|
|
|
default_conf,
|
|
|
|
|
stake_amount,
|
|
|
|
|
min_stake,
|
|
|
|
|
stake_available,
|
|
|
|
|
max_stake,
|
|
|
|
|
expected,
|
|
|
|
|
):
|
|
|
|
|
freqtrade = get_patched_freqtradebot(mocker, default_conf)
|
|
|
|
|
|
|
|
|
|
mocker.patch("freqtrade.wallets.Wallets.get_available_stake_amount",
|
|
|
|
|
return_value=max_stake_amount)
|
|
|
|
|
res = freqtrade.wallets.validate_stake_amount('XRP/USDT', stake_amount, min_stake_amount)
|
|
|
|
|
return_value=stake_available)
|
|
|
|
|
res = freqtrade.wallets.validate_stake_amount('XRP/USDT', stake_amount, min_stake, max_stake)
|
|
|
|
|
assert res == expected
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|