fix: resolve shared symbol mapping for token command (#22)
Build Docker Image / build (amd64) (push) Successful in 1m36s

Co-authored-by: thuanle <tl@thuanle.me>
Co-committed-by: thuanle <tl@thuanle.me>
This commit was merged in pull request #22.
This commit is contained in:
2026-04-26 21:13:06 +07:00
committed by claudecode
parent 1486681ef9
commit 72fdb598af
4 changed files with 204 additions and 7 deletions
+35
View File
@@ -0,0 +1,35 @@
package binancex
import (
"strings"
"me.thuanle/bbot/internal/data"
)
func Token2FutureSymbols(token string) []string {
return Token2Symbols(token)
}
func Token2SpotSymbols(token string) []string {
futureSymbols := Token2FutureSymbols(token)
spots := make([]string, 0, len(futureSymbols)+1)
seen := make(map[string]struct{}, len(futureSymbols)+1)
for _, futureSymbol := range futureSymbols {
spotSymbol := Future2SpotSymbol(futureSymbol)
if _, ok := seen[spotSymbol]; ok {
continue
}
seen[spotSymbol] = struct{}{}
spots = append(spots, spotSymbol)
}
spotOnly := strings.ToUpper(token) + "USDT"
if data.Market.IsSpotPair(spotOnly) {
if _, ok := seen[spotOnly]; !ok {
spots = append(spots, spotOnly)
}
}
return spots
}