Merge pull request #1277 from freqtrade/feat/hide_dust

Hide low value balances from `/balance`
This commit is contained in:
Matthias 2018-10-12 19:15:46 +02:00 committed by GitHub
commit cda3ddffac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 8 deletions

View File

@ -307,11 +307,14 @@ class Telegram(RPC):
result = self._rpc_balance(self._config.get('fiat_display_currency', ''))
output = ''
for currency in result['currencies']:
output += "*{currency}:*\n" \
"\t`Available: {available: .8f}`\n" \
"\t`Balance: {balance: .8f}`\n" \
"\t`Pending: {pending: .8f}`\n" \
"\t`Est. BTC: {est_btc: .8f}`\n".format(**currency)
if currency['est_btc'] > 0.0001:
output += "*{currency}:*\n" \
"\t`Available: {available: .8f}`\n" \
"\t`Balance: {balance: .8f}`\n" \
"\t`Pending: {pending: .8f}`\n" \
"\t`Est. BTC: {est_btc: .8f}`\n".format(**currency)
else:
output += "*{currency}:* not showing <1$ amount \n".format(**currency)
output += "\n*Estimated Value*:\n" \
"\t`BTC: {total: .8f}`\n" \

View File

@ -507,7 +507,12 @@ def test_telegram_balance_handle(default_conf, update, mocker) -> None:
'total': 10.0,
'free': 10.0,
'used': 0.0
}
},
'XRP': {
'total': 1.0,
'free': 1.0,
'used': 0.0
}
}
def mock_ticker(symbol, refresh):
@ -517,7 +522,12 @@ def test_telegram_balance_handle(default_conf, update, mocker) -> None:
'ask': 10000.00,
'last': 10000.00,
}
elif symbol == 'XRP/BTC':
return {
'bid': 0.00001,
'ask': 0.00001,
'last': 0.00001,
}
return {
'bid': 0.1,
'ask': 0.1,
@ -548,7 +558,8 @@ def test_telegram_balance_handle(default_conf, update, mocker) -> None:
assert '*USDT:*' in result
assert 'Balance:' in result
assert 'Est. BTC:' in result
assert 'BTC: 14.00000000' in result
assert 'BTC: 12.00000000' in result
assert '*XRP:* not showing <1$ amount' in result
def test_balance_handle_empty_response(default_conf, update, mocker) -> None: