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.
 
 

41 lines
598 B

package types
type Side int32
const (
SideLong Side = 1 // LONG
SideShort Side = 2 // SHORT
)
func (side Side) IsValid() bool {
return side == SideLong || side == SideShort
}
// Opposite 获取相反交易方向
func (side Side) Opposite() Side {
switch side {
case SideLong:
return SideShort
case SideShort:
return SideLong
default:
return 0
}
}
func (side Side) String() string {
switch side {
default:
return ""
case SideLong:
return "LONG"
case SideShort:
return "SHORT"
}
}
// SideInst 交易方向和对象
type SideInst struct {
InstId string
Side Side
}