From bef3f9c933584df54dc6760232a7ded1a98a9885 Mon Sep 17 00:00:00 2001 From: kbearXD Date: Mon, 13 May 2024 14:32:48 +0800 Subject: [PATCH] not emit WaitToOpenPosition when kline event --- pkg/strategy/dca2/state.go | 2 +- pkg/strategy/dca2/strategy.go | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/strategy/dca2/state.go b/pkg/strategy/dca2/state.go index d4b64d3ac8..3f1aa20324 100644 --- a/pkg/strategy/dca2/state.go +++ b/pkg/strategy/dca2/state.go @@ -74,7 +74,7 @@ func (s *Strategy) emitNextState(nextState State) { // TakeProfitReady -> the takeProfit order filled -> func (s *Strategy) runState(ctx context.Context) { s.logger.Info("[DCA] runState") - stateTriggerTicker := time.NewTicker(3 * time.Minute) + stateTriggerTicker := time.NewTicker(1 * time.Minute) defer stateTriggerTicker.Stop() for { diff --git a/pkg/strategy/dca2/strategy.go b/pkg/strategy/dca2/strategy.go index 5e1179d724..28c5648a93 100644 --- a/pkg/strategy/dca2/strategy.go +++ b/pkg/strategy/dca2/strategy.go @@ -263,8 +263,6 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo. session.MarketDataStream.OnKLine(func(kline types.KLine) { switch s.state { - case WaitToOpenPosition: - s.emitNextState(PositionOpening) case OpenPositionOrderFilled: if s.takeProfitPrice.IsZero() { s.logger.Warn("take profit price should not be 0 when there is at least one open-position order filled, please check it")