twap: handle delayInterval after canceling order

This commit is contained in:
c9s 2024-08-20 17:51:44 +08:00
parent 9a2b792ed1
commit a0cbf82d97
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

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