Made regex strings raw

Removed unwanted changes
This commit is contained in:
Ron Klinkien 2022-03-30 19:57:02 +02:00
parent c42af7d095
commit 6c811b3de1

View File

@ -190,8 +190,8 @@ class Telegram(RPCHandler):
pattern='update_sell_reason_performance'), pattern='update_sell_reason_performance'),
CallbackQueryHandler(self._mix_tag_performance, pattern='update_mix_tag_performance'), CallbackQueryHandler(self._mix_tag_performance, pattern='update_mix_tag_performance'),
CallbackQueryHandler(self._count, pattern='update_count'), CallbackQueryHandler(self._count, pattern='update_count'),
CallbackQueryHandler(self._forcebuy_inline, pattern="\S+\/\S+"), CallbackQueryHandler(self._forcebuy_inline, pattern=r"\S+\/\S+"),
CallbackQueryHandler(self._forcesell_inline, pattern="[0-9]+\s\S+\/\S+") CallbackQueryHandler(self._forcesell_inline, pattern=r"[0-9]+\s\S+\/\S+")
] ]
for handle in handles: for handle in handles:
self._updater.dispatcher.add_handler(handle) self._updater.dispatcher.add_handler(handle)
@ -380,6 +380,8 @@ class Telegram(RPCHandler):
first_avg = filled_orders[0]["safe_price"] first_avg = filled_orders[0]["safe_price"]
for x, order in enumerate(filled_orders): for x, order in enumerate(filled_orders):
if order['ft_order_side'] != 'buy':
continue
cur_entry_datetime = arrow.get(order["order_filled_date"]) cur_entry_datetime = arrow.get(order["order_filled_date"])
cur_entry_amount = order["amount"] cur_entry_amount = order["amount"]
cur_entry_average = order["safe_price"] cur_entry_average = order["safe_price"]
@ -445,7 +447,7 @@ class Telegram(RPCHandler):
messages = [] messages = []
for r in results: for r in results:
r['open_date_hum'] = arrow.get(r['open_date']).humanize() r['open_date_hum'] = arrow.get(r['open_date']).humanize()
r['num_entries'] = len(r['filled_entry_orders']) r['num_entries'] = len([o for o in r['orders'] if o['ft_order_side'] == 'buy'])
r['sell_reason'] = r.get('sell_reason', "") r['sell_reason'] = r.get('sell_reason', "")
lines = [ lines = [
"*Trade ID:* `{trade_id}`" + "*Trade ID:* `{trade_id}`" +
@ -489,8 +491,8 @@ class Telegram(RPCHandler):
lines.append("*Open Order:* `{open_order}`") lines.append("*Open Order:* `{open_order}`")
lines_detail = self._prepare_entry_details( lines_detail = self._prepare_entry_details(
r['filled_entry_orders'], r['base_currency'], r['is_open']) r['orders'], r['base_currency'], r['is_open'])
lines.extend((lines_detail if (len(r['filled_entry_orders']) > 1) else "")) lines.extend(lines_detail if lines_detail else "")
# Filter empty lines using list-comprehension # Filter empty lines using list-comprehension
messages.append("\n".join([line for line in lines if line]).format(**r)) messages.append("\n".join([line for line in lines if line]).format(**r))