fix: recognize spot-only tokens in IsToken #25

Merged
thuanle merged 4 commits from fix/issue-24-is-token-spot-only into main 2026-04-27 05:00:41 +07:00
2 changed files with 9 additions and 3 deletions
Showing only changes of commit 0705e909dc - Show all commits
@@ -137,6 +137,14 @@ func TestIsToken(t *testing.T) {
},
want: true,
},
{
name: "spot only token fallback",
input: "abc",
marketStub: &resolverMarketStub{
spotPairs: map[string]bool{"ABCUSDT": true},
},
want: true,
},
{
name: "non alphanumeric input",
input: "bad!",
+1 -3
View File
@@ -30,12 +30,10 @@ var (
)
func IsToken(s string) bool {
// First check regular symbols
if len(Token2FutureSymbols(s)) > 0 {
if len(Token2SpotSymbols(s)) > 0 {
return true
}
// Then check Alpha tokens
s = strings.ToUpper(s)
return data.Market.IsAlphaToken(s)
}