grid2: move emitGridReady to earlier

This commit is contained in:
c9s 2023-04-26 17:30:31 +08:00
parent e8a761e331
commit 036bae692e
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 5 additions and 4 deletions

View File

@ -54,7 +54,7 @@ func newClosedLimitOrder(symbol string, side types.SideType, price, quantity fix
}
func TestProfitFixer(t *testing.T) {
testOrderID = 0
testClosedOrderID = 0
mockCtrl := gomock.NewController(t)
defer mockCtrl.Finish()

View File

@ -63,18 +63,19 @@ func (s *Strategy) recoverByScanningTrades(ctx context.Context, session *bbgo.Ex
return errors.Wrap(err, "grid recover error")
}
// emit ready after recover
s.EmitGridReady()
// debug and send metrics
// wait for the reverse order to be placed
time.Sleep(2 * time.Second)
debugGrid(s.logger, s.grid, s.orderExecutor.ActiveMakerOrders())
// emit ready after recover
s.EmitGridReady()
defer bbgo.Sync(ctx, s)
if s.EnableProfitFixer {
until := time.Now()
since := until.Add(7 * 24 * time.Hour)
since := until.Add(-7 * 24 * time.Hour)
if s.FixProfitSince != nil {
since = s.FixProfitSince.Time()
}