Merge pull request #1162 from c9s/fix/profit-fixer

FIX: [grid2] emit grid profit after profit stats fix
This commit is contained in:
Yo-An Lin 2023-04-27 00:45:11 +08:00 committed by GitHub
commit 32543c3773
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -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

View File

@ -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)
})