Skip to content

Commit

Permalink
pkg/exchange: update okx symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
bailantaotao committed May 16, 2024
1 parent 62e236e commit ecc08fa
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 ecc08fa

Please sign in to comment.