diff --git a/bbgo/types/kline.go b/bbgo/types/kline.go index 5352895ef..ca0e2b95a 100644 --- a/bbgo/types/kline.go +++ b/bbgo/types/kline.go @@ -157,7 +157,7 @@ func (k KLine) Color() string { func (k KLine) SlackAttachment() slack.Attachment { return slack.Attachment{ - Text: "KLine", + Text: fmt.Sprintf("KLine %s %s", k.Symbol, k.Interval), Color: k.Color(), Fields: []slack.AttachmentField{ { @@ -165,11 +165,6 @@ func (k KLine) SlackAttachment() slack.Attachment { Value: k.Open, Short: true, }, - { - Title: "Close", - Value: k.Close, - Short: true, - }, { Title: "High", Value: k.High, @@ -180,6 +175,11 @@ func (k KLine) SlackAttachment() slack.Attachment { Value: k.Low, Short: true, }, + { + Title: "Close", + Value: k.Close, + Short: true, + }, { Title: "Mid", Value: util.FormatFloat(k.Mid(), 2), @@ -379,8 +379,14 @@ func (k KLineWindow) GetLowerShadowHeight() float64 { } func (k KLineWindow) SlackAttachment() slack.Attachment { + var first KLine + var windowSize = len(k) + if windowSize > 0 { + first = k[0] + } + return slack.Attachment{ - Text: "KLine", + Text: fmt.Sprintf("KLine %s %s x %d", first.Symbol, first.Interval, windowSize), Color: k.Color(), Fields: []slack.AttachmentField{ { @@ -388,11 +394,6 @@ func (k KLineWindow) SlackAttachment() slack.Attachment { Value: util.FormatFloat(k.GetOpen(), 2), Short: true, }, - { - Title: "Close", - Value: util.FormatFloat(k.GetClose(), 2), - Short: true, - }, { Title: "High", Value: util.FormatFloat(k.GetHigh(), 2), @@ -403,6 +404,11 @@ func (k KLineWindow) SlackAttachment() slack.Attachment { Value: util.FormatFloat(k.GetLow(), 2), Short: true, }, + { + Title: "Close", + Value: util.FormatFloat(k.GetClose(), 2), + Short: true, + }, { Title: "Mid", Value: util.FormatFloat(k.Mid(), 2),