From b643b8ed0defc5fc17dfa4d6d496f990907b8d7a Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 5 Jul 2022 12:15:31 +0800 Subject: [PATCH] fix LowerShadowTakeProfit kline filter condition --- pkg/bbgo/exit_cumulated_volume_take_profit.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pkg/bbgo/exit_cumulated_volume_take_profit.go b/pkg/bbgo/exit_cumulated_volume_take_profit.go index 864e949ab..8ba7ed65f 100644 --- a/pkg/bbgo/exit_cumulated_volume_take_profit.go +++ b/pkg/bbgo/exit_cumulated_volume_take_profit.go @@ -36,11 +36,7 @@ func (s *CumulatedVolumeTakeProfit) Bind(session *ExchangeSession, orderExecutor store, _ := session.MarketDataStore(position.Symbol) - session.MarketDataStream.OnKLineClosed(func(kline types.KLine) { - if kline.Symbol != position.Symbol || kline.Interval != s.Interval { - return - } - + session.MarketDataStream.OnKLineClosed(types.KLineWith(s.Symbol, s.Interval, func(kline types.KLine) { closePrice := kline.Close if position.IsClosed() || position.IsDust(closePrice) { return @@ -79,5 +75,5 @@ func (s *CumulatedVolumeTakeProfit) Bind(session *ExchangeSession, orderExecutor _ = orderExecutor.ClosePosition(context.Background(), fixedpoint.One, "cumulatedVolumeTakeProfit") return } - }) + })) }