|
@@ -4,16 +4,31 @@ Info Commands - Handles information-related Telegram commands.
|
|
|
"""
|
|
|
|
|
|
import logging
|
|
|
-from datetime import datetime
|
|
|
+from datetime import datetime, timezone, timedelta
|
|
|
from typing import Optional, Dict, Any, List
|
|
|
from telegram import Update
|
|
|
from telegram.ext import ContextTypes
|
|
|
+import matplotlib.pyplot as plt
|
|
|
+import matplotlib.dates as mdates
|
|
|
+from io import BytesIO
|
|
|
+import traceback
|
|
|
|
|
|
from src.config.config import Config
|
|
|
from src.utils.price_formatter import format_price_with_symbol, get_formatter
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
+def _normalize_token_case(token: str) -> str:
|
|
|
+ """
|
|
|
+ Normalize token case: if any characters are already uppercase, keep as-is.
|
|
|
+ Otherwise, convert to uppercase. This handles mixed-case tokens like kPEPE, kBONK.
|
|
|
+ """
|
|
|
+ # Check if any character is already uppercase
|
|
|
+ if any(c.isupper() for c in token):
|
|
|
+ return token # Keep original case for mixed-case tokens
|
|
|
+ else:
|
|
|
+ return token.upper() # Convert to uppercase for all-lowercase input
|
|
|
+
|
|
|
class InfoCommands:
|
|
|
"""Handles all information-related Telegram commands."""
|
|
|
|
|
@@ -708,7 +723,7 @@ class InfoCommands:
|
|
|
|
|
|
# Get token from arguments or use default
|
|
|
if context.args and len(context.args) > 0:
|
|
|
- token = context.args[0].upper()
|
|
|
+ token = _normalize_token_case(context.args[0])
|
|
|
else:
|
|
|
token = Config.DEFAULT_TRADING_TOKEN
|
|
|
|
|
@@ -774,7 +789,7 @@ class InfoCommands:
|
|
|
|
|
|
# Get token from arguments or use default
|
|
|
if context.args and len(context.args) > 0:
|
|
|
- token = context.args[0].upper()
|
|
|
+ token = _normalize_token_case(context.args[0])
|
|
|
else:
|
|
|
token = Config.DEFAULT_TRADING_TOKEN
|
|
|
|
|
@@ -821,7 +836,7 @@ class InfoCommands:
|
|
|
# Check if specific token is requested
|
|
|
if context.args and len(context.args) >= 1:
|
|
|
# Detailed performance for specific token
|
|
|
- token = context.args[0].upper()
|
|
|
+ token = _normalize_token_case(context.args[0])
|
|
|
await self._show_token_performance(chat_id, token, context)
|
|
|
else:
|
|
|
# Show token performance ranking
|