diff --git a/pkg/twap/v2/stream_executor.go b/pkg/twap/v2/stream_executor.go index 1b41889bb..9fb2e9a50 100644 --- a/pkg/twap/v2/stream_executor.go +++ b/pkg/twap/v2/stream_executor.go @@ -49,8 +49,6 @@ type FixedQuantityExecutor struct { executionCtx context.Context cancelExecution context.CancelFunc - orderUpdateRateLimit *rate.Limiter - userDataStreamCtx context.Context cancelUserDataStream context.CancelFunc @@ -61,10 +59,11 @@ type FixedQuantityExecutor struct { userDataStream types.Stream - activeMakerOrders *bbgo.ActiveOrderBook - orderStore *core.OrderStore - position *types.Position - tradeCollector *core.TradeCollector + orderUpdateRateLimit *rate.Limiter + activeMakerOrders *bbgo.ActiveOrderBook + orderStore *core.OrderStore + position *types.Position + tradeCollector *core.TradeCollector logger logrus.FieldLogger @@ -353,6 +352,10 @@ func (e *FixedQuantityExecutor) updateOrder(ctx context.Context) error { e.tradeCollector.Process() + if e.delayInterval > 0 { + time.Sleep(e.delayInterval) + } + orderForm, err := e.generateOrder() if err != nil { return err