From d38c3afb40691977f662d24e26eab5a7e4b4bd8f Mon Sep 17 00:00:00 2001 From: c9s Date: Sat, 11 Jul 2020 13:15:10 +0800 Subject: [PATCH] move side name color --- types/color.go | 17 +++++++++++++++++ types/order.go | 13 ------------- 2 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 types/color.go diff --git a/types/color.go b/types/color.go new file mode 100644 index 000000000..482c98efe --- /dev/null +++ b/types/color.go @@ -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" +} diff --git a/types/order.go b/types/order.go index 399f12453..8e050a42b 100644 --- a/types/order.go +++ b/types/order.go @@ -5,9 +5,6 @@ import ( "github.com/slack-go/slack" ) -const Green = "#228B22" -const Red = "#800000" - type Order struct { Symbol string 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" -}