Use tabulate to create sell reason message.
This commit is contained in:
parent
44ad0f631c
commit
627e221b65
@ -769,16 +769,21 @@ class Telegram(RPC):
|
||||
win_loss_count = {'Wins': 0, 'Losses': 0, 'Draws': 0}
|
||||
win_loss_count[trade_win_loss(trade)] += 1
|
||||
sell_reasons[trade['sell_reason']] = win_loss_count
|
||||
sell_reason_msg = [
|
||||
'| Sell Reason | Sells | Wins | Draws | Losses |',
|
||||
'|-------------|------:|-----:|------:|-------:|'
|
||||
]
|
||||
sell_reasons_tabulate = []
|
||||
# | Sell Reason | Sells | Wins | Draws | Losses |
|
||||
# |-------------|------:|-----:|------:|-------:|
|
||||
# | test | 1 | 2 | 3 | 4 |
|
||||
for reason, count in sell_reasons.items():
|
||||
msg = f'| `{reason}` | `{sum(count.values())}` | `{count['Wins']}` | `{count['Draws']}` | `{count['Losses']}` |'
|
||||
sell_reason_msg.append(msg)
|
||||
sell_reasons_tabulate.append([
|
||||
reason, sum(count.values()),
|
||||
count['Wins'],
|
||||
count['Draws'],
|
||||
count['Losses']
|
||||
])
|
||||
sell_reasons_msg = tabulate(
|
||||
sell_reasons_tabulate,
|
||||
headers=['Sell Reason', 'Sells', 'Wins', 'Draws', 'Losses']
|
||||
)
|
||||
|
||||
# TODO: Duration
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user