|
@@ -28,16 +28,25 @@ class NotificationManager:
|
|
|
# Use TokenDisplayFormatter for consistent formatting
|
|
|
formatter = get_formatter() # Get formatter
|
|
|
|
|
|
- price_str = formatter.format_price_with_symbol(price, token)
|
|
|
amount_str = formatter.format_amount(amount, token)
|
|
|
- value_str = formatter.format_price_with_symbol(amount * price, token)
|
|
|
order_id_str = order_details.get('id', 'N/A')
|
|
|
|
|
|
- message = (
|
|
|
- f"✅ Successfully opened <b>LONG</b> position for {amount_str} {token} at ~{price_str}\n\n"
|
|
|
- f"💰 Value: {value_str}\n"
|
|
|
- f"🆔 Order ID: <code>{order_id_str}</code>"
|
|
|
- )
|
|
|
+ if price is not None:
|
|
|
+ price_str = formatter.format_price_with_symbol(price, token)
|
|
|
+ value_str = formatter.format_price_with_symbol(amount * price, token)
|
|
|
+ message = (
|
|
|
+ f"✅ Successfully opened <b>LONG</b> position for {amount_str} {token} at ~{price_str}\n\n"
|
|
|
+ f"💰 Value: {value_str}\n"
|
|
|
+ f"🆔 Order ID: <code>{order_id_str}</code>"
|
|
|
+ )
|
|
|
+ else:
|
|
|
+ # Handle market order where price is not known yet
|
|
|
+ message = (
|
|
|
+ f"✅ Successfully submitted <b>LONG</b> market order for {amount_str} {token}.\n\n"
|
|
|
+ f"⏳ Awaiting fill confirmation for final price and value.\n"
|
|
|
+ f"🆔 Order ID: <code>{order_id_str}</code>"
|
|
|
+ )
|
|
|
+
|
|
|
if trade_lifecycle_id:
|
|
|
message += f"\n🆔 Lifecycle ID: <code>{trade_lifecycle_id[:8]}...</code>"
|
|
|
|
|
@@ -54,16 +63,25 @@ class NotificationManager:
|
|
|
try:
|
|
|
formatter = get_formatter() # Get formatter
|
|
|
|
|
|
- price_str = formatter.format_price_with_symbol(price, token)
|
|
|
amount_str = formatter.format_amount(amount, token)
|
|
|
- value_str = formatter.format_price_with_symbol(amount * price, token)
|
|
|
order_id_str = order_details.get('id', 'N/A')
|
|
|
-
|
|
|
- message = (
|
|
|
- f"✅ Successfully opened <b>SHORT</b> position for {amount_str} {token} at ~{price_str}\n\n"
|
|
|
- f"💰 Value: {value_str}\n"
|
|
|
- f"🆔 Order ID: <code>{order_id_str}</code>"
|
|
|
- )
|
|
|
+
|
|
|
+ if price is not None:
|
|
|
+ price_str = formatter.format_price_with_symbol(price, token)
|
|
|
+ value_str = formatter.format_price_with_symbol(amount * price, token)
|
|
|
+ message = (
|
|
|
+ f"✅ Successfully opened <b>SHORT</b> position for {amount_str} {token} at ~{price_str}\n\n"
|
|
|
+ f"💰 Value: {value_str}\n"
|
|
|
+ f"🆔 Order ID: <code>{order_id_str}</code>"
|
|
|
+ )
|
|
|
+ else:
|
|
|
+ # Handle market order where price is not known yet
|
|
|
+ message = (
|
|
|
+ f"✅ Successfully submitted <b>SHORT</b> market order for {amount_str} {token}.\n\n"
|
|
|
+ f"⏳ Awaiting fill confirmation for final price and value.\n"
|
|
|
+ f"🆔 Order ID: <code>{order_id_str}</code>"
|
|
|
+ )
|
|
|
+
|
|
|
if trade_lifecycle_id:
|
|
|
message += f"\n🆔 Lifecycle ID: <code>{trade_lifecycle_id[:8]}...</code>"
|
|
|
|