Merge pull request #1635 from c9s/edwin/okx/update-symbols-map

FIX: [okx] update okx symbols
This commit is contained in:
bailantaotao 2024-05-16 15:47:02 +08:00 committed by GitHub
commit 4c1d3f1c44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 556 additions and 513 deletions

View File

@ -14,8 +14,7 @@ func toGlobalSymbol(symbol string) string {
return strings.ReplaceAll(symbol, "-", "")
}
// //go:generate sh -c "echo \"package okex\nvar spotSymbolMap = map[string]string{\n\" $(curl -s -L 'https://okex.com/api/v5/public/instruments?instType=SPOT' | jq -r '.data[] | \"\\(.instId | sub(\"-\" ; \"\") | tojson ): \\( .instId | tojson),\n\"') \"\n}\" > symbols.go"
//
//go:generate sh -c "echo \"package okex\nvar spotSymbolMap = map[string]string{\n\" $(curl -s -L 'https://www.okx.com/api/v5/public/instruments?instType=SPOT' | jq -r '.data[] | \"\\(.instId | sub(\"-\" ; \"\") | tojson ): \\( .instId | tojson),\n\"') \"\n}\" > symbols.go"
//go:generate go run gensymbols.go
func toLocalSymbol(symbol string) string {
if s, ok := spotSymbolMap[symbol]; ok {

View File

@ -27,7 +27,7 @@ var spotSymbolMap = map[string]string{
func main() {
ctx := context.Background()
client := okexapi.NewClient()
instruments, err := client.PublicDataService.NewGetInstrumentsRequest().InstrumentType(okexapi.InstrumentTypeSpot).Do(ctx)
instruments, err := client.NewGetInstrumentsInfoRequest().InstType(okexapi.InstrumentTypeSpot).Do(ctx)
if err != nil {
log.Fatal(err)
}

File diff suppressed because it is too large Load Diff