Add /balance full, reduce regular balance output

closes #4497
This commit is contained in:
Matthias 2023-04-22 15:51:28 +02:00
parent 7a47500b22
commit dbf1f0897e
3 changed files with 17 additions and 12 deletions

View File

@ -191,7 +191,8 @@ official commands. You can ask at any moment for help with `/help`.
| **Metrics** |
| `/profit [<n>]` | Display a summary of your profit/loss from close trades and some stats about your performance, over the last n days (all trades by default)
| `/performance` | Show performance of each finished trade grouped by pair
| `/balance` | Show account balance per currency
| `/balance` | Show bot managed balance per currency
| `/balance full` | Show account balance per currency
| `/daily <n>` | Shows profit or loss per day, over the last n days (n defaults to 7)
| `/weekly <n>` | Shows profit or loss per week, over the last n weeks (n defaults to 8)
| `/monthly <n>` | Shows profit or loss per month, over the last n months (n defaults to 6)
@ -202,7 +203,6 @@ official commands. You can ask at any moment for help with `/help`.
| `/blacklist [pair]` | Show the current blacklist, or adds a pair to the blacklist.
| `/edge` | Show validated pairs by Edge if it is enabled.
## Telegram commands in action
Below, example of Telegram message you will receive for each command.

View File

@ -678,8 +678,10 @@ class RPC:
return {
'currencies': currencies,
'total': total,
'total_bot': total_bot,
'symbol': fiat_display_currency,
'value': value,
'value_bot': value_bot,
'stake': stake_currency,
'starting_capital': starting_capital,
'starting_capital_ratio': starting_capital_ratio,

View File

@ -905,6 +905,7 @@ class Telegram(RPCHandler):
@authorized_only
def _balance(self, update: Update, context: CallbackContext) -> None:
""" Handler for /balance """
full_result = context.args and 'full' in context.args
result = self._rpc._rpc_balance(self._config['stake_currency'],
self._config.get('fiat_display_currency', ''))
@ -928,7 +929,7 @@ class Telegram(RPCHandler):
total_dust_currencies = 0
for curr in result['currencies']:
curr_output = ''
if curr['est_stake'] > balance_dust_level:
if curr['est_stake'] > balance_dust_level and (full_result or curr['is_bot_managed']):
if curr['is_position']:
curr_output = (
f"*{curr['currency']}:*\n"
@ -965,14 +966,15 @@ class Telegram(RPCHandler):
tc = result['trade_count'] > 0
stake_improve = f" `({result['starting_capital_ratio']:.2%})`" if tc else ''
fiat_val = f" `({result['starting_capital_fiat_ratio']:.2%})`" if tc else ''
output += ("\n*Estimated Value*:\n"
f"\t`{result['stake']}: "
f"{round_coin_value(result['total'], result['stake'], False)}`"
f"{stake_improve}\n"
f"\t`{result['symbol']}: "
f"{round_coin_value(result['value'], result['symbol'], False)}`"
f"{fiat_val}\n")
value = round_coin_value(
result['value' if full_result else 'value_bot'], result['symbol'], False)
total_stake = round_coin_value(
result['total' if full_result else 'total_bot'], result['stake'], False)
output += (
f"\n*Estimated Value{' (Bot managed assets only)' if not full_result else ''}*:\n"
f"\t`{result['stake']}: {total_stake}`{stake_improve}\n"
f"\t`{result['symbol']}: {value}`{fiat_val}\n"
)
self._send_msg(output, reload_able=True, callback_path="update_balance",
query=update.callback_query)
@ -1528,7 +1530,8 @@ class Telegram(RPCHandler):
"------------\n"
"*/show_config:* `Show running configuration` \n"
"*/locks:* `Show currently locked pairs`\n"
"*/balance:* `Show account balance per currency`\n"
"*/balance:* `Show bot managed balance per currency`\n"
"*/balance total:* `Show account balance per currency`\n"
"*/logs [limit]:* `Show latest logs - defaults to 10` \n"
"*/count:* `Show number of active trades compared to allowed number of trades`\n"
"*/edge:* `Shows validated pairs by Edge if it is enabled` \n"