mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
include trade-duration with sell-notification
This commit is contained in:
parent
1495c93083
commit
e4655c9b07
|
@ -962,7 +962,9 @@ class FreqtradeBot:
|
|||
'current_rate': current_rate,
|
||||
'profit_amount': profit_trade,
|
||||
'profit_percent': profit_percent,
|
||||
'sell_reason': trade.sell_reason
|
||||
'sell_reason': trade.sell_reason,
|
||||
'open_date': trade.open_date,
|
||||
'close_date': trade.close_date or datetime.utcnow()
|
||||
}
|
||||
|
||||
# For regular case, when the configuration exists
|
||||
|
|
|
@ -9,7 +9,7 @@ from typing import Any, Callable, Dict
|
|||
from tabulate import tabulate
|
||||
from telegram import ParseMode, ReplyKeyboardMarkup, Update
|
||||
from telegram.error import NetworkError, TelegramError
|
||||
from telegram.ext import CommandHandler, Updater, CallbackContext
|
||||
from telegram.ext import CallbackContext, CommandHandler, Updater
|
||||
|
||||
from freqtrade.__init__ import __version__
|
||||
from freqtrade.rpc import RPC, RPCException, RPCMessageType
|
||||
|
@ -144,6 +144,8 @@ class Telegram(RPC):
|
|||
elif msg['type'] == RPCMessageType.SELL_NOTIFICATION:
|
||||
msg['amount'] = round(msg['amount'], 8)
|
||||
msg['profit_percent'] = round(msg['profit_percent'] * 100, 2)
|
||||
msg['duration'] = msg['close_date'].replace(
|
||||
microsecond=0) - msg['open_date'].replace(microsecond=0)
|
||||
|
||||
message = ("*{exchange}:* Selling {pair}\n"
|
||||
"*Rate:* `{limit:.8f}`\n"
|
||||
|
@ -151,6 +153,7 @@ class Telegram(RPC):
|
|||
"*Open Rate:* `{open_rate:.8f}`\n"
|
||||
"*Current Rate:* `{current_rate:.8f}`\n"
|
||||
"*Sell Reason:* `{sell_reason}`\n"
|
||||
"*Duration:* `{duration}`\n"
|
||||
"*Profit:* `{profit_percent:.2f}%`").format(**msg)
|
||||
|
||||
# Check if all sell properties are available.
|
||||
|
|
Loading…
Reference in New Issue
Block a user