Merge pull request #2628 from freqtrade/rpc/sell_duration

Telegram / sell duration
This commit is contained in:
Matthias
2019-12-11 07:15:00 +01:00
committed by GitHub
5 changed files with 45 additions and 14 deletions

View File

@@ -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

View File

@@ -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,9 @@ 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)
msg['duration_min'] = msg['duration'].total_seconds() / 60
message = ("*{exchange}:* Selling {pair}\n"
"*Rate:* `{limit:.8f}`\n"
@@ -151,6 +154,7 @@ class Telegram(RPC):
"*Open Rate:* `{open_rate:.8f}`\n"
"*Current Rate:* `{current_rate:.8f}`\n"
"*Sell Reason:* `{sell_reason}`\n"
"*Duration:* `{duration} ({duration_min:.1f} min)`\n"
"*Profit:* `{profit_percent:.2f}%`").format(**msg)
# Check if all sell properties are available.