bbgo: show pnl in the slack fields

This commit is contained in:
c9s 2021-10-18 08:45:27 +08:00
parent d446dbbed7
commit c36bbd6c35

View File

@ -265,6 +265,14 @@ func (s *ProfitStats) SlackAttachment() slack.Attachment {
var fields []slack.AttachmentField
if s.TodayPnL != 0 {
fields = append(fields, slack.AttachmentField{
Title: "P&L Today",
Value: pnlSignString(s.TodayPnL) + " " + s.QuoteCurrency,
Short: true,
})
}
if s.TodayProfit != 0 {
fields = append(fields, slack.AttachmentField{
Title: "Profit Today",
@ -289,6 +297,13 @@ func (s *ProfitStats) SlackAttachment() slack.Attachment {
})
}
if s.AccumulatedPnL != 0 {
fields = append(fields, slack.AttachmentField{
Title: "Accumulated P&L",
Value: pnlSignString(s.AccumulatedPnL) + " " + s.QuoteCurrency,
})
}
if s.AccumulatedProfit != 0 {
fields = append(fields, slack.AttachmentField{
Title: "Accumulated Profit",