mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +00:00
okex: add local symbol convert function
This commit is contained in:
parent
016c60796d
commit
364e6fc990
|
@ -5,3 +5,12 @@ import "strings"
|
|||
func toGlobalSymbol(symbol string) string {
|
||||
return strings.ReplaceAll(symbol, "-", "")
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ import (
|
|||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
//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"
|
||||
|
||||
// OKB is the platform currency of OKEx, pre-allocate static string here
|
||||
const OKB = "OKB"
|
||||
|
||||
|
|
5
pkg/exchange/okex/symbols.go
Normal file
5
pkg/exchange/okex/symbols.go
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user