|
@@ -44,22 +44,22 @@ class PriceCommands(InfoCommandsBase):
|
|
|
price_text_parts = [f"💰 <b>{token} Price Information</b>"]
|
|
|
|
|
|
# Current price
|
|
|
- current_price = float(ticker.get('last', 0))
|
|
|
+ current_price = float(ticker.get('last') or 0)
|
|
|
price_text_parts.append(f"\n📊 <b>Current Price:</b> {await formatter.format_price_with_symbol(current_price, token)}")
|
|
|
|
|
|
# 24h change
|
|
|
- change_24h = float(ticker.get('percentage', 0))
|
|
|
+ change_24h = float(ticker.get('percentage') or 0)
|
|
|
change_emoji = "🟢" if change_24h >= 0 else "🔴"
|
|
|
price_text_parts.append(f"📈 <b>24h Change:</b> {change_emoji} {change_24h:+.2f}%")
|
|
|
|
|
|
# 24h high/low
|
|
|
- high_24h = float(ticker.get('high', 0))
|
|
|
- low_24h = float(ticker.get('low', 0))
|
|
|
+ high_24h = float(ticker.get('high') or 0)
|
|
|
+ low_24h = float(ticker.get('low') or 0)
|
|
|
price_text_parts.append(f"📊 <b>24h Range:</b> {await formatter.format_price_with_symbol(low_24h, token)} - {await formatter.format_price_with_symbol(high_24h, token)}")
|
|
|
|
|
|
# Volume
|
|
|
- volume_24h = float(ticker.get('quoteVolume', 0))
|
|
|
- price_text_parts.append(f"💎 <b>24h Volume:</b> {await formatter.format_price_with_symbol(volume_24h)}")
|
|
|
+ volume_24h = float(ticker.get('quoteVolume') or 0)
|
|
|
+ price_text_parts.append(f"💎 <b>24h Volume:</b> {await formatter.format_price_with_symbol(volume_24h, token)}")
|
|
|
|
|
|
final_message = "\n".join(price_text_parts)
|
|
|
await context.bot.edit_message_text(
|