adding percentage to telegram status messages

This commit is contained in:
Misagh
2019-04-01 19:13:45 +02:00
parent ecd75e43b0
commit ab579587f2
5 changed files with 18 additions and 6 deletions

View File

@@ -111,6 +111,9 @@ class RPC(object):
close_profit=fmt_close_profit,
current_profit=round(current_profit * 100, 2),
stop_loss=trade.stop_loss,
stop_loss_pct=trade.stop_loss_pct,
initial_stop_loss=trade.initial_stop_loss,
initial_stop_loss_pct=trade.initial_stop_loss_pct,
open_order='({} {} rem={:.8f})'.format(
order['type'], order['side'], order['remaining']
) if order else None,

View File

@@ -197,7 +197,7 @@ class Telegram(RPC):
messages = []
for r in results:
lines = [
"*Trade ID:* `{trade_id}` (since `{date}`)",
"*Trade ID:* `{trade_id}` `(since {date})`",
"*Current Pair:* {pair}",
"*Amount:* `{amount}`",
"*Open Rate:* `{open_rate:.8f}`",
@@ -205,7 +205,9 @@ class Telegram(RPC):
"*Current Rate:* `{current_rate:.8f}`",
"*Close Profit:* `{close_profit}`" if r['close_profit'] else "",
"*Current Profit:* `{current_profit:.2f}%`",
"*Stoploss:* `{stop_loss:.8f}`",
"*Initial Stoploss:* `{initial_stop_loss:.8f}` `({initial_stop_loss_pct}%)`"
if r['stop_loss'] != r['initial_stop_loss'] else "",
"*Stoploss:* `{stop_loss:.8f}` `({stop_loss_pct}%)`",
"*Open Order:* `{open_order}`" if r['open_order'] else "",
]
messages.append("\n".join(filter(None, lines)).format(**r))