mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +00:00
types: simplify ValidExchangeName function
This commit is contained in:
parent
9f1c2f9ae4
commit
ad502f67e9
|
@ -58,15 +58,11 @@ var SupportedExchanges = []ExchangeName{
|
|||
}
|
||||
|
||||
func ValidExchangeName(a string) (ExchangeName, error) {
|
||||
switch strings.ToLower(a) {
|
||||
case "max":
|
||||
return ExchangeMax, nil
|
||||
case "binance", "bn":
|
||||
return ExchangeBinance, nil
|
||||
case "okex":
|
||||
return ExchangeOKEx, nil
|
||||
case "kucoin":
|
||||
return ExchangeKucoin, nil
|
||||
aa := strings.ToLower(a)
|
||||
for _, n := range SupportedExchanges {
|
||||
if string(n) == aa {
|
||||
return n, nil
|
||||
}
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("invalid exchange name: %s", a)
|
||||
|
|
Loading…
Reference in New Issue
Block a user