diff --git a/internal/services/tele/commands/token.go b/internal/services/tele/commands/token.go index bfced49..77f6f57 100644 --- a/internal/services/tele/commands/token.go +++ b/internal/services/tele/commands/token.go @@ -29,20 +29,19 @@ func showStickerMode(context telebot.Context, token string) { func OnTokenInfoByToken(context telebot.Context, token string) error { token = strings.ToUpper(token) - + // Check if it's an Alpha token first if data.Market.IsAlphaToken(token) { showStickerMode(context, token) - + if alphaToken, exists := data.Market.GetAlphaToken(token); exists { sp := alphaToken.GetPrice() - // For Alpha tokens, we don't have future price, funding rate, etc. - // Use spot price for both spot and future in the display - _ = chat.ReplyMessage(context, view.RenderOnPriceMessage(token, sp, sp, 0, 0, 0)) + change24h := alphaToken.GetPercentChange24h() + _ = chat.ReplyMessage(context, view.RenderOnAlphaPriceMessage(token, sp, change24h)) } return nil } - + // Regular token handling symbols := binancex.Token2Symbols(token) if len(symbols) == 0 { diff --git a/internal/services/tele/view/price.go b/internal/services/tele/view/price.go index e5291c8..cdba285 100644 --- a/internal/services/tele/view/price.go +++ b/internal/services/tele/view/price.go @@ -48,6 +48,21 @@ func RenderOnPriceMessage(symbol string, spotPrice float64, futurePrice float64, ) } +func RenderOnAlphaPriceMessage(symbol string, price float64, change24h float64) string { + icon := "🟢" + if change24h < 0 { + icon = "🔴" + } + return fmt.Sprintf( + "🅰️ %s\n"+ + " Price: $%s\n"+ + " 24h: %s%.2f%%", + symbol, + RenderPrice(price), + icon, change24h, + ) +} + func RenderOnGetTopPricesMessage(symbols []string, price []float64, fundRate []float64) string { t := helper.NewNoBorderTableWriter("", "Price", "Fund") mFmt := message.NewPrinter(language.AmericanEnglish)