mirror of
https://github.com/c9s/bbgo.git
synced 2024-09-20 08:11:08 +00:00
improve kline attachment display
This commit is contained in:
parent
80f50ecb19
commit
fc82f446f5
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue
Block a user