mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-13 02:23:51 +00:00
18 lines
565 B
Go
18 lines
565 B
Go
package okex
|
|
|
|
import "strings"
|
|
|
|
func toGlobalSymbol(symbol string) string {
|
|
return strings.ReplaceAll(symbol, "-", "")
|
|
}
|
|
|
|
//go:generate sh -c "echo \"package okex\nvar symbolMap = 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"
|
|
func toLocalSymbol(symbol string) string {
|
|
if s, ok := symbolMap[symbol]; ok {
|
|
return s
|
|
}
|
|
|
|
log.Errorf("failed to look up local symbol from %s", symbol)
|
|
return symbol
|
|
}
|