fix: resolve spot and futures symbols via shared resolver

Introduce a shared token symbol resolver for spot and futures lookups while keeping alpha lookup independent, restoring prefix/remap handling and preserving spot-only fallback behavior.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-26 20:19:51 +07:00
parent 1486681ef9
commit c8be4c4bfd
4 changed files with 203 additions and 7 deletions
+7 -4
View File
@@ -6,6 +6,7 @@ import (
"gopkg.in/telebot.v3"
"me.thuanle/bbot/internal/configs/tele"
"me.thuanle/bbot/internal/data"
"me.thuanle/bbot/internal/helper/binancex"
"me.thuanle/bbot/internal/services/tele/chat"
"me.thuanle/bbot/internal/services/tele/view"
)
@@ -75,21 +76,23 @@ func collectRichTokenData(token string) buildRichTokenMessageArgs {
}
}
futureSymbol := token + "USDT"
if data.Market.IsFuturesPair(futureSymbol) {
futureSymbols := binancex.Token2FutureSymbols(token)
for _, futureSymbol := range futureSymbols {
if fp, fr, ft, ok := data.Market.GetFuturePrice(futureSymbol); ok {
a.HasFuture = true
a.FuturePrice = fp
a.FundingRate = fr
a.FundingTimeMs = ft
break
}
}
spotSymbol := token + "USDT"
if data.Market.IsSpotPair(spotSymbol) {
spotSymbols := binancex.Token2SpotSymbols(token)
for _, spotSymbol := range spotSymbols {
if sp, ok := data.Market.GetSpotPrice(spotSymbol); ok {
a.HasSpot = true
a.SpotPrice = sp
break
}
}