Add dedicated Alpha token price display with 24h change
Build Docker Image / build (amd64) (push) Successful in 1m31s

Alpha tokens now show a simplified format with price and 24h change
instead of the regular token format with empty futures/funding data.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-25 01:51:56 +07:00
parent a5ff76fc96
commit ced55e5f16
2 changed files with 20 additions and 6 deletions
+2 -3
View File
@@ -36,9 +36,8 @@ func OnTokenInfoByToken(context telebot.Context, token string) error {
if alphaToken, exists := data.Market.GetAlphaToken(token); exists { if alphaToken, exists := data.Market.GetAlphaToken(token); exists {
sp := alphaToken.GetPrice() sp := alphaToken.GetPrice()
// For Alpha tokens, we don't have future price, funding rate, etc. change24h := alphaToken.GetPercentChange24h()
// Use spot price for both spot and future in the display _ = chat.ReplyMessage(context, view.RenderOnAlphaPriceMessage(token, sp, change24h))
_ = chat.ReplyMessage(context, view.RenderOnPriceMessage(token, sp, sp, 0, 0, 0))
} }
return nil return nil
} }
+15
View File
@@ -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 { func RenderOnGetTopPricesMessage(symbols []string, price []float64, fundRate []float64) string {
t := helper.NewNoBorderTableWriter("", "Price", "Fund") t := helper.NewNoBorderTableWriter("", "Price", "Fund")
mFmt := message.NewPrinter(language.AmericanEnglish) mFmt := message.NewPrinter(language.AmericanEnglish)