From d3595fc7640672ebc2f1f3d99c8ff7308b6a097b Mon Sep 17 00:00:00 2001 From: adonunes Date: Tue, 7 May 2024 06:26:38 -0400 Subject: [PATCH] woldofwb --- .../server_alert_formatting.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/DiscordAlertsTrader/server_alert_formatting.py b/DiscordAlertsTrader/server_alert_formatting.py index 43815e8..71fef94 100644 --- a/DiscordAlertsTrader/server_alert_formatting.py +++ b/DiscordAlertsTrader/server_alert_formatting.py @@ -59,6 +59,8 @@ def server_formatting(message): message = jpa_formatting(message) elif message.channel.id in [1216951944933933137]: message = prophi_alerts(message) + elif message.channel.id in [968629663394058270, 1141877368877760552]: + message = wolfwebull_formatting(message) elif message.guild.id in [826258453391081524, 1093339706260979822,1072553858053701793, 898981804478980166, 682259216861626378]: message = aurora_trading_formatting(message) else: @@ -828,6 +830,29 @@ def ddking_formatting(message_): message.content = alert return message +def wolfwebull_formatting(message_): + """ + Reformat Discord message from wolfwebull_formatting + """ + message = MessageCopy(message_) + + alert = '' + for mb in message.embeds: + alert = mb.description.replace(" Call ", "C").replace(" Put ", "P") + + pattern = r'([A-Z]+)\s+\$([\d.]+)(C|P)\s+@\s*([\d.]+)' + match = re.search(pattern, alert, re.IGNORECASE) + if match: + ticker, strike, otype, price = match.groups() + expDate= "0DTE" if ticker in ["SPY", "QQQ"] else 'weeklies' + alert = f"BTO {ticker} {strike.upper()}{otype.upper()} {expDate} @{price}" + alert = format_0dte_weeklies(alert, message, False) + else: + alert = f"{mb.description}" + + if len(alert): + message.content = alert + return message def crimson_formatting(message_): """