pivotshort: get the correct pivot low value

This commit is contained in:
c9s 2022-07-27 01:56:18 +08:00
parent 854af6b4bd
commit b746f801f7
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -96,13 +96,13 @@ func (s *BreakLow) Bind(session *bbgo.ExchangeSession, orderExecutor *bbgo.Gener
// update pivot low data
session.MarketDataStream.OnStart(func() {
lastLow := fixedpoint.NewFromFloat(s.pivot.Lows.Last())
lastLow := fixedpoint.NewFromFloat(s.pivot.Last())
if lastLow.IsZero() {
return
}
if lastLow.Compare(s.lastLow) != 0 {
bbgo.Notify("%s found new pivot low: %f", s.Symbol, s.pivot.Lows.Last())
bbgo.Notify("%s found new pivot low: %f", s.Symbol, s.pivot.Last())
}
s.lastLow = lastLow
@ -127,7 +127,7 @@ func (s *BreakLow) Bind(session *bbgo.ExchangeSession, orderExecutor *bbgo.Gener
})
session.MarketDataStream.OnKLineClosed(types.KLineWith(symbol, s.Interval, func(kline types.KLine) {
lastLow := fixedpoint.NewFromFloat(s.pivot.Lows.Last())
lastLow := fixedpoint.NewFromFloat(s.pivot.Last())
if lastLow.IsZero() {
return
}
@ -144,7 +144,7 @@ func (s *BreakLow) Bind(session *bbgo.ExchangeSession, orderExecutor *bbgo.Gener
return
}
bbgo.Notify("%s new pivot low: %f", s.Symbol, s.pivot.Lows.Last())
bbgo.Notify("%s new pivot low: %f", s.Symbol, s.pivot.Last())
}))
session.MarketDataStream.OnKLineClosed(types.KLineWith(symbol, types.Interval1m, func(kline types.KLine) {