fixed test_get_min_pair_stake_amount by adding amount.min/max and cost.min/max to all markets

This commit is contained in:
Sam Germain 2022-01-31 03:02:17 -06:00
parent 5af3e1600d
commit 779b82b5b4

View File

@ -356,23 +356,10 @@ def test_get_min_pair_stake_amount(mocker, default_conf) -> None:
with pytest.raises(ValueError, match=r'.*get market information.*'): with pytest.raises(ValueError, match=r'.*get market information.*'):
exchange.get_min_pair_stake_amount('BNB/BTC', 1, stoploss) exchange.get_min_pair_stake_amount('BNB/BTC', 1, stoploss)
# no 'limits' section
result = exchange.get_min_pair_stake_amount('ETH/BTC', 1, stoploss)
assert result is None
# empty 'limits' section
markets["ETH/BTC"]["limits"] = {}
mocker.patch(
'freqtrade.exchange.Exchange.markets',
PropertyMock(return_value=markets)
)
result = exchange.get_min_pair_stake_amount('ETH/BTC', 1, stoploss)
assert result is None
# no cost Min # no cost Min
markets["ETH/BTC"]["limits"] = { markets["ETH/BTC"]["limits"] = {
'cost': {"min": None}, 'cost': {'min': None, 'max': None},
'amount': {} 'amount': {'min': None, 'max': None},
} }
mocker.patch( mocker.patch(
'freqtrade.exchange.Exchange.markets', 'freqtrade.exchange.Exchange.markets',
@ -383,8 +370,8 @@ def test_get_min_pair_stake_amount(mocker, default_conf) -> None:
# no amount Min # no amount Min
markets["ETH/BTC"]["limits"] = { markets["ETH/BTC"]["limits"] = {
'cost': {}, 'cost': {'min': None, 'max': None},
'amount': {"min": None} 'amount': {'min': None, 'max': None},
} }
mocker.patch( mocker.patch(
'freqtrade.exchange.Exchange.markets', 'freqtrade.exchange.Exchange.markets',
@ -395,8 +382,8 @@ def test_get_min_pair_stake_amount(mocker, default_conf) -> None:
# empty 'cost'/'amount' section # empty 'cost'/'amount' section
markets["ETH/BTC"]["limits"] = { markets["ETH/BTC"]["limits"] = {
'cost': {}, 'cost': {'min': None, 'max': None},
'amount': {} 'amount': {'min': None, 'max': None},
} }
mocker.patch( mocker.patch(
'freqtrade.exchange.Exchange.markets', 'freqtrade.exchange.Exchange.markets',
@ -407,8 +394,8 @@ def test_get_min_pair_stake_amount(mocker, default_conf) -> None:
# min cost is set # min cost is set
markets["ETH/BTC"]["limits"] = { markets["ETH/BTC"]["limits"] = {
'cost': {'min': 2}, 'cost': {'min': 2, 'max': None},
'amount': {} 'amount': {'min': None, 'max': None},
} }
mocker.patch( mocker.patch(
'freqtrade.exchange.Exchange.markets', 'freqtrade.exchange.Exchange.markets',
@ -423,8 +410,8 @@ def test_get_min_pair_stake_amount(mocker, default_conf) -> None:
# min amount is set # min amount is set
markets["ETH/BTC"]["limits"] = { markets["ETH/BTC"]["limits"] = {
'cost': {}, 'cost': {'min': None, 'max': None},
'amount': {'min': 2} 'amount': {'min': 2, 'max': None},
} }
mocker.patch( mocker.patch(
'freqtrade.exchange.Exchange.markets', 'freqtrade.exchange.Exchange.markets',
@ -439,8 +426,8 @@ def test_get_min_pair_stake_amount(mocker, default_conf) -> None:
# min amount and cost are set (cost is minimal) # min amount and cost are set (cost is minimal)
markets["ETH/BTC"]["limits"] = { markets["ETH/BTC"]["limits"] = {
'cost': {'min': 2}, 'cost': {'min': 2, 'max': None},
'amount': {'min': 2} 'amount': {'min': 2, 'max': None},
} }
mocker.patch( mocker.patch(
'freqtrade.exchange.Exchange.markets', 'freqtrade.exchange.Exchange.markets',
@ -455,8 +442,8 @@ def test_get_min_pair_stake_amount(mocker, default_conf) -> None:
# min amount and cost are set (amount is minial) # min amount and cost are set (amount is minial)
markets["ETH/BTC"]["limits"] = { markets["ETH/BTC"]["limits"] = {
'cost': {'min': 8}, 'cost': {'min': 8, 'max': None},
'amount': {'min': 2} 'amount': {'min': 2, 'max': None},
} }
mocker.patch( mocker.patch(
'freqtrade.exchange.Exchange.markets', 'freqtrade.exchange.Exchange.markets',