mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
Change enter_tag, exit_reason, mix_tag performance messages from HTML to Markdown to fix some string encoding issues.
This commit is contained in:
committed by
Joe Schr
parent
c99184af21
commit
51d799828b
@@ -4,7 +4,6 @@
|
|||||||
This module manage Telegram communication
|
This module manage Telegram communication
|
||||||
"""
|
"""
|
||||||
import asyncio
|
import asyncio
|
||||||
import html
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
@@ -1376,21 +1375,21 @@ class Telegram(RPCHandler):
|
|||||||
pair = context.args[0]
|
pair = context.args[0]
|
||||||
|
|
||||||
trades = self._rpc._rpc_enter_tag_performance(pair)
|
trades = self._rpc._rpc_enter_tag_performance(pair)
|
||||||
output = "<b>Entry Tag Performance:</b>\n"
|
output = "*Entry Tag Performance:*\n"
|
||||||
for i, trade in enumerate(trades):
|
for i, trade in enumerate(trades):
|
||||||
stat_line = (
|
stat_line = (
|
||||||
f"{i + 1}.\t <code>{html.escape(trade['enter_tag'])}\t"
|
f"{i + 1}.\t `{trade['enter_tag']}\t"
|
||||||
f"{fmt_coin(trade['profit_abs'], self._config['stake_currency'])} "
|
f"{fmt_coin(trade['profit_abs'], self._config['stake_currency'])} "
|
||||||
f"({trade['profit_ratio']:.2%}) "
|
f"({trade['profit_ratio']:.2%}) "
|
||||||
f"({trade['count']})</code>\n")
|
f"({trade['count']})`\n")
|
||||||
|
|
||||||
if len(output + stat_line) >= MAX_MESSAGE_LENGTH:
|
if len(output + stat_line) >= MAX_MESSAGE_LENGTH:
|
||||||
await self._send_msg(output, parse_mode=ParseMode.HTML)
|
await self._send_msg(output, parse_mode=ParseMode.MARKDOWN_V2)
|
||||||
output = stat_line
|
output = stat_line
|
||||||
else:
|
else:
|
||||||
output += stat_line
|
output += stat_line
|
||||||
|
|
||||||
await self._send_msg(output, parse_mode=ParseMode.HTML,
|
await self._send_msg(output, parse_mode=ParseMode.MARKDOWN_V2,
|
||||||
reload_able=True, callback_path="update_enter_tag_performance",
|
reload_able=True, callback_path="update_enter_tag_performance",
|
||||||
query=update.callback_query)
|
query=update.callback_query)
|
||||||
|
|
||||||
@@ -1408,21 +1407,21 @@ class Telegram(RPCHandler):
|
|||||||
pair = context.args[0]
|
pair = context.args[0]
|
||||||
|
|
||||||
trades = self._rpc._rpc_exit_reason_performance(pair)
|
trades = self._rpc._rpc_exit_reason_performance(pair)
|
||||||
output = "<b>Exit Reason Performance:</b>\n"
|
output = "*Exit Reason Performance:*\n"
|
||||||
for i, trade in enumerate(trades):
|
for i, trade in enumerate(trades):
|
||||||
stat_line = (
|
stat_line = (
|
||||||
f"{i + 1}.\t <code>{html.escape(trade['exit_reason'])}\t"
|
f"{i + 1}\.\t `{html.escape(trade['exit_reason'])}\t"
|
||||||
f"{fmt_coin(trade['profit_abs'], self._config['stake_currency'])} "
|
f"{fmt_coin(trade['profit_abs'], self._config['stake_currency'])} "
|
||||||
f"({trade['profit_ratio']:.2%}) "
|
f"({trade['profit_ratio']:.2%}) "
|
||||||
f"({trade['count']})</code>\n")
|
f"({trade['count']})`\n")
|
||||||
|
|
||||||
if len(output + stat_line) >= MAX_MESSAGE_LENGTH:
|
if len(output + stat_line) >= MAX_MESSAGE_LENGTH:
|
||||||
await self._send_msg(output, parse_mode=ParseMode.HTML)
|
await self._send_msg(output, parse_mode=ParseMode.MARKDOWN_V2)
|
||||||
output = stat_line
|
output = stat_line
|
||||||
else:
|
else:
|
||||||
output += stat_line
|
output += stat_line
|
||||||
|
|
||||||
await self._send_msg(output, parse_mode=ParseMode.HTML,
|
await self._send_msg(output, parse_mode=ParseMode.MARKDOWN_V2,
|
||||||
reload_able=True, callback_path="update_exit_reason_performance",
|
reload_able=True, callback_path="update_exit_reason_performance",
|
||||||
query=update.callback_query)
|
query=update.callback_query)
|
||||||
|
|
||||||
@@ -1440,21 +1439,21 @@ class Telegram(RPCHandler):
|
|||||||
pair = context.args[0]
|
pair = context.args[0]
|
||||||
|
|
||||||
trades = self._rpc._rpc_mix_tag_performance(pair)
|
trades = self._rpc._rpc_mix_tag_performance(pair)
|
||||||
output = "<b>Mix Tag Performance:</b>\n"
|
output = "*Mix Tag Performance:*\n"
|
||||||
for i, trade in enumerate(trades):
|
for i, trade in enumerate(trades):
|
||||||
stat_line = (
|
stat_line = (
|
||||||
f"{i + 1}.\t <code>{html.escape(trade['mix_tag'])}\t"
|
f"{i + 1}\.\t `{trade['mix_tag']}\t"
|
||||||
f"{fmt_coin(trade['profit_abs'], self._config['stake_currency'])} "
|
f"{fmt_coin(trade['profit_abs'], self._config['stake_currency'])} "
|
||||||
f"({trade['profit_ratio']:.2%}) "
|
f"({trade['profit_ratio']:.2%}) "
|
||||||
f"({trade['count']})</code>\n")
|
f"({trade['count']})`\n")
|
||||||
|
|
||||||
if len(output + stat_line) >= MAX_MESSAGE_LENGTH:
|
if len(output + stat_line) >= MAX_MESSAGE_LENGTH:
|
||||||
await self._send_msg(output, parse_mode=ParseMode.HTML)
|
await self._send_msg(output, parse_mode=ParseMode.MARKDOWN_V2)
|
||||||
output = stat_line
|
output = stat_line
|
||||||
else:
|
else:
|
||||||
output += stat_line
|
output += stat_line
|
||||||
|
|
||||||
await self._send_msg(output, parse_mode=ParseMode.HTML,
|
await self._send_msg(output, parse_mode=ParseMode.MARKDOWN_V2,
|
||||||
reload_able=True, callback_path="update_mix_tag_performance",
|
reload_able=True, callback_path="update_mix_tag_performance",
|
||||||
query=update.callback_query)
|
query=update.callback_query)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user