move side name color

This commit is contained in:
c9s 2020-07-11 13:15:10 +08:00
parent 62e27957c1
commit d38c3afb40
2 changed files with 17 additions and 13 deletions

17
types/color.go Normal file
View File

@ -0,0 +1,17 @@
package types
import "github.com/adshao/go-binance"
const Green = "#228B22"
const Red = "#800000"
func SideToColorName(side binance.SideType) string {
if side == binance.SideTypeBuy {
return Green
}
if side == binance.SideTypeSell {
return Red
}
return "#f0f0f0"
}

View File

@ -5,9 +5,6 @@ import (
"github.com/slack-go/slack" "github.com/slack-go/slack"
) )
const Green = "#228B22"
const Red = "#800000"
type Order struct { type Order struct {
Symbol string Symbol string
Side binance.SideType Side binance.SideType
@ -37,13 +34,3 @@ func (o *Order) SlackAttachment() slack.Attachment {
} }
} }
func SideToColorName(side binance.SideType) string {
if side == binance.SideTypeBuy {
return Green
}
if side == binance.SideTypeSell {
return Red
}
return "#f0f0f0"
}