diff --git a/internal/services/tele/commands/token.go b/internal/services/tele/commands/token.go index 3ef9698..c292891 100644 --- a/internal/services/tele/commands/token.go +++ b/internal/services/tele/commands/token.go @@ -12,6 +12,8 @@ import ( "strings" ) +var lastEthPrice float64 + func showStickerMode(context telebot.Context, token string) { token = strings.ToUpper(token) stickerIdx, ok := tele.Token2StickerIdxMap[token] @@ -43,18 +45,35 @@ func OnTokenInfoByToken(context telebot.Context, token string) error { _ = chat.ReplyMessage(context, view.RenderOnPriceMessage(symbols[0], sp, fp, fundRate, fundTime, tokenInterestRate)) if strings.ToUpper(token) == "ETH" { + mFmt := message.NewPrinter(language.AmericanEnglish) baseAmount := 14. basePrice := 2500.0 baseTotal := baseAmount * basePrice curTotal := baseAmount * sp - mFmt := message.NewPrinter(language.AmericanEnglish) + lastDelta := "" + if lastEthPrice == 0 { + lastEthPrice = sp + } else { + lastDelta = mFmt.Sprintf( + "Δ price: %+,.0f\n"+ + "Δ Usdt: %+,.0f\n", + sp-lastEthPrice, + (sp-lastEthPrice)*baseAmount, + ) + lastEthPrice = sp + } msg := mFmt.Sprintf( "🎉∑ Bắc Kiều Foy's USDT: %.0f\n"+ - "🎊 Bắc Kiều Foy's lợi nhuận: %.0f", - curTotal, curTotal-baseTotal, + "🎊 Bắc Kiều Foy's lợi nhuận: %.0f\n"+ + "%s"+ + "@th13vn", + curTotal, + curTotal-baseTotal, + lastDelta, ) + _ = chat.ReplyMessage(context, msg) } return nil