Skip to content

Commit

Permalink
not emit WaitToOpenPosition when kline event
Browse files Browse the repository at this point in the history
  • Loading branch information
kbearXD committed May 13, 2024
1 parent 6cdd2f0 commit f49924c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/strategy/dca2/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions pkg/strategy/dca2/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit f49924c

Please sign in to comment.