fix LowerShadowTakeProfit kline filter condition

This commit is contained in:
c9s 2022-07-05 12:15:31 +08:00
parent 8ac21fa16e
commit b643b8ed0d
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -36,11 +36,7 @@ func (s *CumulatedVolumeTakeProfit) Bind(session *ExchangeSession, orderExecutor
store, _ := session.MarketDataStore(position.Symbol) store, _ := session.MarketDataStore(position.Symbol)
session.MarketDataStream.OnKLineClosed(func(kline types.KLine) { session.MarketDataStream.OnKLineClosed(types.KLineWith(s.Symbol, s.Interval, func(kline types.KLine) {
if kline.Symbol != position.Symbol || kline.Interval != s.Interval {
return
}
closePrice := kline.Close closePrice := kline.Close
if position.IsClosed() || position.IsDust(closePrice) { if position.IsClosed() || position.IsDust(closePrice) {
return return
@ -79,5 +75,5 @@ func (s *CumulatedVolumeTakeProfit) Bind(session *ExchangeSession, orderExecutor
_ = orderExecutor.ClosePosition(context.Background(), fixedpoint.One, "cumulatedVolumeTakeProfit") _ = orderExecutor.ClosePosition(context.Background(), fixedpoint.One, "cumulatedVolumeTakeProfit")
return return
} }
}) }))
} }