diff --git a/example/Codes2/main.go b/example/Codes2/main.go index e78c89d..15861f9 100644 --- a/example/Codes2/main.go +++ b/example/Codes2/main.go @@ -2,6 +2,8 @@ package main import ( "fmt" + "strings" + "github.com/injoyai/logs" "github.com/injoyai/tdx" ) @@ -13,4 +15,11 @@ func main() { c := cs.Get("sz000001") fmt.Println(c.FloatStock, c.TotalStock) + + for _, v := range cs.GetIndexes().Codes() { + if strings.HasPrefix(v, "sz") { + logs.Debug(v) + } + } + } diff --git a/protocol/unit.go b/protocol/unit.go index 0384c1d..3ed78b0 100644 --- a/protocol/unit.go +++ b/protocol/unit.go @@ -302,7 +302,9 @@ func IsIndex(code string) bool { case code[0:2] == ExchangeSH.String() && code[2:5] == "000": return true case code[0:2] == ExchangeSZ.String() && code[2:5] == "399": + return true case code[0:2] == ExchangeBJ.String() && code[2:5] == "899": + return true } return false }