mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +00:00
pull out side type
This commit is contained in:
parent
d38c3afb40
commit
efca619949
|
@ -1,17 +1,27 @@
|
|||
package types
|
||||
|
||||
import "github.com/adshao/go-binance"
|
||||
|
||||
const Green = "#228B22"
|
||||
const Red = "#800000"
|
||||
|
||||
func SideToColorName(side binance.SideType) string {
|
||||
if side == binance.SideTypeBuy {
|
||||
// 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 == binance.SideTypeSell {
|
||||
if side == SideTypeSell {
|
||||
return Red
|
||||
}
|
||||
|
||||
return "#f0f0f0"
|
||||
}
|
||||
|
||||
func SideToColorName(side SideType) string {
|
||||
return side.Color()
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ func (o *Order) SlackAttachment() slack.Attachment {
|
|||
}
|
||||
|
||||
return slack.Attachment{
|
||||
Color: SideToColorName(o.Side),
|
||||
Color: SideToColorName(SideType(o.Side)),
|
||||
Title: string(o.Type) + " Order " + string(o.Side),
|
||||
// Text: "",
|
||||
Fields: fields,
|
||||
|
|
Loading…
Reference in New Issue
Block a user