BacFoy Delta
All checks were successful
Build Docker Image / build (amd64) (push) Successful in 2m9s

This commit is contained in:
thuanle
2025-08-22 22:54:27 +07:00
parent b9e6abf4cf
commit a3b2db7666

View File

@@ -12,6 +12,8 @@ import (
"strings" "strings"
) )
var lastEthPrice float64
func showStickerMode(context telebot.Context, token string) { func showStickerMode(context telebot.Context, token string) {
token = strings.ToUpper(token) token = strings.ToUpper(token)
stickerIdx, ok := tele.Token2StickerIdxMap[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)) _ = chat.ReplyMessage(context, view.RenderOnPriceMessage(symbols[0], sp, fp, fundRate, fundTime, tokenInterestRate))
if strings.ToUpper(token) == "ETH" { if strings.ToUpper(token) == "ETH" {
mFmt := message.NewPrinter(language.AmericanEnglish)
baseAmount := 14. baseAmount := 14.
basePrice := 2500.0 basePrice := 2500.0
baseTotal := baseAmount * basePrice baseTotal := baseAmount * basePrice
curTotal := baseAmount * sp 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( msg := mFmt.Sprintf(
"🎉∑ Bắc Kiều Foy's USDT: %.0f\n"+ "🎉∑ Bắc Kiều Foy's USDT: %.0f\n"+
"🎊 Bắc Kiều Foy's lợi nhuận: %.0f", "🎊 Bắc Kiều Foy's lợi nhuận: %.0f\n"+
curTotal, curTotal-baseTotal, "%s"+
"@th13vn",
curTotal,
curTotal-baseTotal,
lastDelta,
) )
_ = chat.ReplyMessage(context, msg) _ = chat.ReplyMessage(context, msg)
} }
return nil return nil