Merge pull request #1845 from freqtrade/fix/1840
Fix #1840 - Support balances other than USDT
This commit is contained in:
commit
175fc8591e
@ -276,11 +276,12 @@ class RPC(object):
|
|||||||
rate = 1.0
|
rate = 1.0
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
if coin == 'USDT':
|
if coin in('USDT', 'USD', 'EUR'):
|
||||||
rate = 1.0 / self._freqtrade.get_sell_rate('BTC/USDT', False)
|
rate = 1.0 / self._freqtrade.get_sell_rate('BTC/' + coin, False)
|
||||||
else:
|
else:
|
||||||
rate = self._freqtrade.get_sell_rate(coin + '/BTC', False)
|
rate = self._freqtrade.get_sell_rate(coin + '/BTC', False)
|
||||||
except (TemporaryError, DependencyException):
|
except (TemporaryError, DependencyException):
|
||||||
|
logger.warning(f" Could not get rate for pair {coin}.")
|
||||||
continue
|
continue
|
||||||
est_btc: float = rate * balance['total']
|
est_btc: float = rate * balance['total']
|
||||||
total = total + est_btc
|
total = total + est_btc
|
||||||
|
@ -522,6 +522,11 @@ def test_telegram_balance_handle(default_conf, update, mocker) -> None:
|
|||||||
'total': 1.0,
|
'total': 1.0,
|
||||||
'free': 1.0,
|
'free': 1.0,
|
||||||
'used': 0.0
|
'used': 0.0
|
||||||
|
},
|
||||||
|
'EUR': {
|
||||||
|
'total': 10.0,
|
||||||
|
'free': 10.0,
|
||||||
|
'used': 0.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -565,6 +570,7 @@ def test_telegram_balance_handle(default_conf, update, mocker) -> None:
|
|||||||
assert '*BTC:*' in result
|
assert '*BTC:*' in result
|
||||||
assert '*ETH:*' not in result
|
assert '*ETH:*' not in result
|
||||||
assert '*USDT:*' in result
|
assert '*USDT:*' in result
|
||||||
|
assert '*EUR:*' in result
|
||||||
assert 'Balance:' in result
|
assert 'Balance:' in result
|
||||||
assert 'Est. BTC:' in result
|
assert 'Est. BTC:' in result
|
||||||
assert 'BTC: 12.00000000' in result
|
assert 'BTC: 12.00000000' in result
|
||||||
|
Loading…
Reference in New Issue
Block a user