parent
c5a00b4d45
commit
2d4ce593b5
@ -277,11 +277,14 @@ class FreqtradeBot(object):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
min_stake_amounts = []
|
min_stake_amounts = []
|
||||||
if 'cost' in market['limits'] and 'min' in market['limits']['cost']:
|
limits = market['limits']
|
||||||
min_stake_amounts.append(market['limits']['cost']['min'])
|
if ('cost' in limits and 'min' in limits['cost']
|
||||||
|
and limits['cost']['min'] is not None):
|
||||||
|
min_stake_amounts.append(limits['cost']['min'])
|
||||||
|
|
||||||
if 'amount' in market['limits'] and 'min' in market['limits']['amount']:
|
if ('amount' in limits and 'min' in limits['amount']
|
||||||
min_stake_amounts.append(market['limits']['amount']['min'] * price)
|
and limits['amount']['min'] is not None):
|
||||||
|
min_stake_amounts.append(limits['amount']['min'] * price)
|
||||||
|
|
||||||
if not min_stake_amounts:
|
if not min_stake_amounts:
|
||||||
return None
|
return None
|
||||||
|
@ -348,6 +348,34 @@ def test_get_min_pair_stake_amount(mocker, default_conf) -> None:
|
|||||||
result = freqtrade._get_min_pair_stake_amount('ETH/BTC', 1)
|
result = freqtrade._get_min_pair_stake_amount('ETH/BTC', 1)
|
||||||
assert result is None
|
assert result is None
|
||||||
|
|
||||||
|
# no cost Min
|
||||||
|
mocker.patch(
|
||||||
|
'freqtrade.exchange.Exchange.get_markets',
|
||||||
|
MagicMock(return_value=[{
|
||||||
|
'symbol': 'ETH/BTC',
|
||||||
|
'limits': {
|
||||||
|
'cost': {"min": None},
|
||||||
|
'amount': {}
|
||||||
|
}
|
||||||
|
}])
|
||||||
|
)
|
||||||
|
result = freqtrade._get_min_pair_stake_amount('ETH/BTC', 1)
|
||||||
|
assert result is None
|
||||||
|
|
||||||
|
# no amount Min
|
||||||
|
mocker.patch(
|
||||||
|
'freqtrade.exchange.Exchange.get_markets',
|
||||||
|
MagicMock(return_value=[{
|
||||||
|
'symbol': 'ETH/BTC',
|
||||||
|
'limits': {
|
||||||
|
'cost': {},
|
||||||
|
'amount': {"min": None}
|
||||||
|
}
|
||||||
|
}])
|
||||||
|
)
|
||||||
|
result = freqtrade._get_min_pair_stake_amount('ETH/BTC', 1)
|
||||||
|
assert result is None
|
||||||
|
|
||||||
# empty 'cost'/'amount' section
|
# empty 'cost'/'amount' section
|
||||||
mocker.patch(
|
mocker.patch(
|
||||||
'freqtrade.exchange.Exchange.get_markets',
|
'freqtrade.exchange.Exchange.get_markets',
|
||||||
|
Loading…
Reference in New Issue
Block a user