You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

33 lines
706 B

package types
import "sig-pub/api/pb"
type Exchange string
var (
ExchangeSIG = Exchange(pb.Exchange_SIG.String())
ExchangeOKX = Exchange(pb.Exchange_OKX.String()) // okx
ExchangeBINANCE = Exchange(pb.Exchange_BINANCE.String()) // 币安
)
func (ex Exchange) Exchange2PB() (pb.Exchange, bool) {
switch ex {
case ExchangeOKX:
return pb.Exchange_OKX, true
case ExchangeBINANCE:
return pb.Exchange_BINANCE, true
default:
return pb.Exchange_SIG, false
}
}
func ExchangePBParse(pbex pb.Exchange) (Exchange, bool) {
switch pbex {
case pb.Exchange_OKX:
return ExchangeOKX, true
case pb.Exchange_BINANCE:
return ExchangeBINANCE, true
default:
return ExchangeSIG, false
}
}