From 32b2c431987778839ff3006aec7f86dc66f62c3f Mon Sep 17 00:00:00 2001 From: c9s Date: Thu, 27 Apr 2023 00:33:42 +0800 Subject: [PATCH] grid2: emit grid profit after profit stats fix --- pkg/strategy/grid2/recover.go | 2 ++ pkg/strategy/grid2/strategy.go | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/strategy/grid2/recover.go b/pkg/strategy/grid2/recover.go index 1fdcfa79b..fec69a2ef 100644 --- a/pkg/strategy/grid2/recover.go +++ b/pkg/strategy/grid2/recover.go @@ -89,6 +89,8 @@ func (s *Strategy) recoverByScanningTrades(ctx context.Context, session *bbgo.Ex } s.logger.Infof("fixed profitStats: %#v", s.GridProfitStats) + + s.EmitGridProfit(s.GridProfitStats, nil) } return nil diff --git a/pkg/strategy/grid2/strategy.go b/pkg/strategy/grid2/strategy.go index 2c6beacd5..bd6743009 100644 --- a/pkg/strategy/grid2/strategy.go +++ b/pkg/strategy/grid2/strategy.go @@ -1852,7 +1852,9 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo. s.orderExecutor = orderExecutor s.OnGridProfit(func(stats *GridProfitStats, profit *GridProfit) { - bbgo.Notify(profit) + if profit != nil { + bbgo.Notify(profit) + } bbgo.Notify(stats) })