Skip to content

Commit

Permalink
Merge pull request #1635 from c9s/edwin/okx/update-symbols-map
Browse files Browse the repository at this point in the history
FIX: [okx] update okx symbols
  • Loading branch information
bailantaotao authored May 16, 2024
2 parents 62e236e + ecc08fa commit 4c1d3f1
Show file tree
Hide file tree
Showing 3 changed files with 556 additions and 513 deletions.
3 changes: 1 addition & 2 deletions pkg/exchange/okex/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/exchange/okex/gensymbols.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Loading

0 comments on commit 4c1d3f1

Please sign in to comment.