diff --git a/types/color.go b/types/color.go index 482c98efe..63ccd71d6 100644 --- a/types/color.go +++ b/types/color.go @@ -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() +} diff --git a/types/order.go b/types/order.go index 8e050a42b..81e6e0153 100644 --- a/types/order.go +++ b/types/order.go @@ -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,