pkg/exchange: update okx symbols

This commit is contained in:
edwin 2024-05-16 15:29:47 +08:00
parent 62e236edf1
commit ecc08fabb7
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