xmaker: add tradeScanOverlapBufferPeriod time

This commit is contained in:
c9s 2023-07-22 17:30:24 +08:00
parent 941067670e
commit 70439f3fd9
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -595,6 +595,8 @@ func (s *Strategy) tradeRecover(ctx context.Context) {
tradeScanInterval = 30 * time.Minute
}
tradeScanOverlapBufferPeriod := 5 * time.Minute
tradeScanTicker := time.NewTicker(tradeScanInterval)
defer tradeScanTicker.Stop()
@ -607,7 +609,7 @@ func (s *Strategy) tradeRecover(ctx context.Context) {
log.Infof("scanning trades from %s ago...", tradeScanInterval)
if s.RecoverTrade {
startTime := time.Now().Add(-tradeScanInterval)
startTime := time.Now().Add(-tradeScanInterval).Add(-tradeScanOverlapBufferPeriod)
if err := s.tradeCollector.Recover(ctx, s.sourceSession.Exchange.(types.ExchangeTradeHistoryService), s.Symbol, startTime); err != nil {
log.WithError(err).Errorf("query trades error")