Merge pull request #2710 from freqtrade/rpc_balance_output

/balance should not convert to BTC
This commit is contained in:
hroff-1902 2019-12-24 23:59:05 +03:00 committed by GitHub
commit 5e6e625694
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -341,13 +341,14 @@ class RPC:
raise RPCException('All balances are zero.') raise RPCException('All balances are zero.')
symbol = fiat_display_currency symbol = fiat_display_currency
value = self._fiat_converter.convert_amount(total, 'BTC', value = self._fiat_converter.convert_amount(total, stake_currency,
symbol) if self._fiat_converter else 0 symbol) if self._fiat_converter else 0
return { return {
'currencies': output, 'currencies': output,
'total': total, 'total': total,
'symbol': symbol, 'symbol': symbol,
'value': value, 'value': value,
'stake': stake_currency,
'note': 'Simulated balances' if self._freqtrade.config.get('dry_run', False) else '' 'note': 'Simulated balances' if self._freqtrade.config.get('dry_run', False) else ''
} }

View File

@ -335,7 +335,7 @@ class Telegram(RPC):
output = '' output = ''
if self._config['dry_run']: if self._config['dry_run']:
output += ( output += (
f"*Warning:*Simulated balances in Dry Mode.\n" f"*Warning:* Simulated balances in Dry Mode.\n"
"This mode is still experimental!\n" "This mode is still experimental!\n"
"Starting capital: " "Starting capital: "
f"`{self._config['dry_run_wallet']}` {self._config['stake_currency']}.\n" f"`{self._config['dry_run_wallet']}` {self._config['stake_currency']}.\n"
@ -358,7 +358,7 @@ class Telegram(RPC):
output += curr_output output += curr_output
output += "\n*Estimated Value*:\n" \ output += "\n*Estimated Value*:\n" \
"\t`BTC: {total: .8f}`\n" \ "\t`{stake}: {total: .8f}`\n" \
"\t`{symbol}: {value: .2f}`\n".format(**result) "\t`{symbol}: {value: .2f}`\n".format(**result)
self._send_msg(output) self._send_msg(output)
except RPCException as e: except RPCException as e:

View File

@ -534,7 +534,7 @@ def test_balance_handle_empty_response_dry(default_conf, update, mocker) -> None
telegram._balance(update=update, context=MagicMock()) telegram._balance(update=update, context=MagicMock())
result = msg_mock.call_args_list[0][0][0] result = msg_mock.call_args_list[0][0][0]
assert msg_mock.call_count == 1 assert msg_mock.call_count == 1
assert "*Warning:*Simulated balances in Dry Mode." in result assert "*Warning:* Simulated balances in Dry Mode." in result
assert "Starting capital: `1000` BTC" in result assert "Starting capital: `1000` BTC" in result