mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
add color.go
This commit is contained in:
parent
efca619949
commit
1c99ca52cb
|
@ -3,25 +3,3 @@ package types
|
|||
const Green = "#228B22"
|
||||
const Red = "#800000"
|
||||
|
||||
// SideType define side type of order
|
||||
type SideType string
|
||||
|
||||
const (
|
||||
SideTypeBuy = SideType("BUY")
|
||||
SideTypeSell = SideType("SELL")
|
||||
)
|
||||
|
||||
func (side SideType) Color() string {
|
||||
if side == SideTypeBuy {
|
||||
return Green
|
||||
}
|
||||
if side == SideTypeSell {
|
||||
return Red
|
||||
}
|
||||
|
||||
return "#f0f0f0"
|
||||
}
|
||||
|
||||
func SideToColorName(side SideType) string {
|
||||
return side.Color()
|
||||
}
|
||||
|
|
24
types/side.go
Normal file
24
types/side.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package types
|
||||
|
||||
// SideType define side type of order
|
||||
type SideType string
|
||||
|
||||
const (
|
||||
SideTypeBuy = SideType("BUY")
|
||||
SideTypeSell = SideType("SELL")
|
||||
)
|
||||
|
||||
func (side SideType) Color() string {
|
||||
if side == SideTypeBuy {
|
||||
return Green
|
||||
}
|
||||
if side == SideTypeSell {
|
||||
return Red
|
||||
}
|
||||
|
||||
return "#f0f0f0"
|
||||
}
|
||||
|
||||
func SideToColorName(side SideType) string {
|
||||
return side.Color()
|
||||
}
|
Loading…
Reference in New Issue
Block a user