From a06b63c8970e542c4d8e8c9a3eebbf950bd5eaaa Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 20 Aug 2024 18:13:42 +0800 Subject: [PATCH] twap: rename constructor --- pkg/cmd/execute_order.go | 2 +- pkg/twap/v2/stream_executor.go | 2 +- pkg/twap/v2/stream_executor_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/cmd/execute_order.go b/pkg/cmd/execute_order.go index d082e1f73..d693a2741 100644 --- a/pkg/cmd/execute_order.go +++ b/pkg/cmd/execute_order.go @@ -161,7 +161,7 @@ var executeOrderCmd = &cobra.Command{ return fmt.Errorf("market %s not found", symbol) } - executor := twap.NewStreamExecutor(session.Exchange, symbol, market, side, targetQuantity, sliceQuantity) + executor := twap.NewFixedQuantityExecutor(session.Exchange, symbol, market, side, targetQuantity, sliceQuantity) if updateInterval > 0 { executor.SetUpdateInterval(updateInterval) diff --git a/pkg/twap/v2/stream_executor.go b/pkg/twap/v2/stream_executor.go index 75214cfe1..1cbea8806 100644 --- a/pkg/twap/v2/stream_executor.go +++ b/pkg/twap/v2/stream_executor.go @@ -74,7 +74,7 @@ type FixedQuantityExecutor struct { done *DoneSignal } -func NewStreamExecutor( +func NewFixedQuantityExecutor( exchange types.Exchange, symbol string, market types.Market, diff --git a/pkg/twap/v2/stream_executor_test.go b/pkg/twap/v2/stream_executor_test.go index 9ed443e27..f0aa79485 100644 --- a/pkg/twap/v2/stream_executor_test.go +++ b/pkg/twap/v2/stream_executor_test.go @@ -170,7 +170,7 @@ func TestNewStreamExecutor(t *testing.T) { } mockEx.EXPECT().SubmitOrder(gomock.AssignableToTypeOf(ctx), firstSubmitOrder).Return(&firstOrder, nil) - executor := NewStreamExecutor(mockEx, symbol, market, types.SideTypeBuy, targetQuantity, sliceQuantity) + executor := NewFixedQuantityExecutor(mockEx, symbol, market, types.SideTypeBuy, targetQuantity, sliceQuantity) executor.SetUpdateInterval(200 * time.Millisecond) go func() {