From c0598a05f6302f80a103dee21fb06e15bfdc2152 Mon Sep 17 00:00:00 2001 From: c9s Date: Thu, 15 Dec 2022 17:47:34 +0800 Subject: [PATCH] grid2: add slack attachment footer --- pkg/strategy/grid2/profit_stats.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/strategy/grid2/profit_stats.go b/pkg/strategy/grid2/profit_stats.go index 8147f9ab8..d19bf6fbd 100644 --- a/pkg/strategy/grid2/profit_stats.go +++ b/pkg/strategy/grid2/profit_stats.go @@ -51,6 +51,11 @@ func (s *GridProfitStats) AddTrade(trade types.Trade) { } else { s.TotalFee[trade.FeeCurrency] = trade.Fee } + + if s.Since == nil { + t := trade.Time.Time() + s.Since = &t + } } func (s *GridProfitStats) AddProfit(profit *GridProfit) { @@ -115,13 +120,18 @@ func (s *GridProfitStats) SlackAttachment() slack.Attachment { Value: fee.String() + " " + feeCurrency, Short: true, }) - } } + footer := "Total grid profit stats" + if s.Since != nil { + footer += fmt.Sprintf(" since %s", s.Since.String()) + } + return slack.Attachment{ Title: "Grid Profit Stats", Color: "warning", Fields: fields, + Footer: footer, } }