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 executionCtx context.Context
cancelExecution context.CancelFunc cancelExecution context.CancelFunc
orderUpdateRateLimit *rate.Limiter
userDataStreamCtx context.Context userDataStreamCtx context.Context
cancelUserDataStream context.CancelFunc cancelUserDataStream context.CancelFunc
@ -61,6 +59,7 @@ type FixedQuantityExecutor struct {
userDataStream types.Stream userDataStream types.Stream
orderUpdateRateLimit *rate.Limiter
activeMakerOrders *bbgo.ActiveOrderBook activeMakerOrders *bbgo.ActiveOrderBook
orderStore *core.OrderStore orderStore *core.OrderStore
position *types.Position position *types.Position
@ -353,6 +352,10 @@ func (e *FixedQuantityExecutor) updateOrder(ctx context.Context) error {
e.tradeCollector.Process() e.tradeCollector.Process()
if e.delayInterval > 0 {
time.Sleep(e.delayInterval)
}
orderForm, err := e.generateOrder() orderForm, err := e.generateOrder()
if err != nil { if err != nil {
return err return err