Add timestamp to trade output

This commit is contained in:
Matthias 2020-05-24 08:46:50 +02:00
parent b50d072d82
commit 110b5a2521
3 changed files with 8 additions and 4 deletions

View File

@ -257,10 +257,12 @@ class Trade(_DECL_BASE):
'fee_close_currency': self.fee_close_currency,
'open_date_hum': arrow.get(self.open_date).humanize(),
'open_date': self.open_date.strftime("%Y-%m-%d %H:%M:%S"),
'open_timestamp': int(self.open_date.timestamp() * 1000),
'close_date_hum': (arrow.get(self.close_date).humanize()
if self.close_date else None),
'close_date': (self.close_date.strftime("%Y-%m-%d %H:%M:%S")
if self.close_date else None),
'close_timestamp': int(self.close_date.timestamp() * 1000) if self.close_date else None,
'open_rate': self.open_rate,
'open_rate_requested': self.open_rate_requested,
'open_trade_price': self.open_trade_price,

View File

@ -135,9 +135,11 @@ class RPC:
trade_dict = trade.to_json()
trade_dict.update(dict(
base_currency=self._freqtrade.config['stake_currency'],
close_profit=fmt_close_profit,
close_profit=trade.close_profit or None,
close_profit_perc=fmt_close_profit,
current_rate=current_rate,
current_profit=round(current_profit * 100, 2),
current_profit_perc=round(current_profit * 100, 2),
current_profit=current_profit,
open_order='({} {} rem={:.8f})'.format(
order['type'], order['side'], order['remaining']
) if order else None,

View File

@ -215,8 +215,8 @@ class Telegram(RPC):
"*Open Rate:* `{open_rate:.8f}`",
"*Close Rate:* `{close_rate}`" if r['close_rate'] else "",
"*Current Rate:* `{current_rate:.8f}`",
"*Close Profit:* `{close_profit}`" if r['close_profit'] else "",
"*Current Profit:* `{current_profit:.2f}%`",
"*Close Profit:* `{close_profit}`" if r['close_profit_perc'] else "",
"*Current Profit:* `{current_profit_perc:.2f}%`",
# Adding initial stoploss only if it is different from stoploss
"*Initial Stoploss:* `{initial_stop_loss:.8f}` " +