mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 16:55:15 +00:00
update pivotlow on start
This commit is contained in:
parent
191e00adeb
commit
89ffd94d98
|
@ -89,6 +89,20 @@ func (s *BreakLow) Bind(session *bbgo.ExchangeSession, orderExecutor *bbgo.Gener
|
||||||
}
|
}
|
||||||
|
|
||||||
// update pivot low data
|
// update pivot low data
|
||||||
|
session.MarketDataStream.OnStart(func() {
|
||||||
|
lastLow := fixedpoint.NewFromFloat(s.pivot.LastLow())
|
||||||
|
if lastLow.IsZero() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if lastLow.Compare(s.lastLow) != 0 {
|
||||||
|
bbgo.Notify("%s new pivot low detected: %f %s", s.Symbol, s.pivot.LastLow(), kline.EndTime.Time().String())
|
||||||
|
}
|
||||||
|
|
||||||
|
s.lastLow = lastLow
|
||||||
|
s.pivotLowPrices = append(s.pivotLowPrices, s.lastLow)
|
||||||
|
})
|
||||||
|
|
||||||
session.MarketDataStream.OnKLineClosed(types.KLineWith(symbol, s.Interval, func(kline types.KLine) {
|
session.MarketDataStream.OnKLineClosed(types.KLineWith(symbol, s.Interval, func(kline types.KLine) {
|
||||||
lastLow := fixedpoint.NewFromFloat(s.pivot.LastLow())
|
lastLow := fixedpoint.NewFromFloat(s.pivot.LastLow())
|
||||||
if lastLow.IsZero() {
|
if lastLow.IsZero() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user