mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-23 07:15:15 +00:00
grid2: adjust rollback duration to twice
This commit is contained in:
parent
a66cee9130
commit
a4f5d15334
|
@ -1055,6 +1055,7 @@ func (s *Strategy) recoverGrid(ctx context.Context, historyService types.Exchang
|
||||||
startTime := firstOrderTime
|
startTime := firstOrderTime
|
||||||
endTime := now
|
endTime := now
|
||||||
maxTries := 3
|
maxTries := 3
|
||||||
|
localHistoryRollbackDuration := historyRollbackDuration
|
||||||
for maxTries > 0 {
|
for maxTries > 0 {
|
||||||
maxTries--
|
maxTries--
|
||||||
if err := s.replayOrderHistory(ctx, grid, orderBook, historyService, startTime, endTime, lastOrderID); err != nil {
|
if err := s.replayOrderHistory(ctx, grid, orderBook, historyService, startTime, endTime, lastOrderID); err != nil {
|
||||||
|
@ -1069,12 +1070,13 @@ func (s *Strategy) recoverGrid(ctx context.Context, historyService types.Exchang
|
||||||
}
|
}
|
||||||
|
|
||||||
// history rollback range
|
// history rollback range
|
||||||
startTime = startTime.Add(-historyRollbackDuration)
|
startTime = startTime.Add(-localHistoryRollbackDuration)
|
||||||
if newFromOrderID := lastOrderID - historyRollbackOrderIdRange; newFromOrderID > 1 {
|
if newFromOrderID := lastOrderID - historyRollbackOrderIdRange; newFromOrderID > 1 {
|
||||||
lastOrderID = newFromOrderID
|
lastOrderID = newFromOrderID
|
||||||
}
|
}
|
||||||
|
|
||||||
s.logger.Infof("GRID RECOVER: there are still more than two missing orders, rolling back query start time to earlier time point %s, fromID %d", startTime.String(), lastOrderID)
|
s.logger.Infof("GRID RECOVER: there are still more than two missing orders, rolling back query start time to earlier time point %s, fromID %d", startTime.String(), lastOrderID)
|
||||||
|
localHistoryRollbackDuration = localHistoryRollbackDuration * 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user