bbgo_origin/pkg/bbgo/marketdatastore_callbacks.go

28 lines
783 B
Go
Raw Normal View History

// Code generated by "callbackgen -type MarketDataStore"; DO NOT EDIT.
package bbgo
import (
"github.com/c9s/bbgo/pkg/types"
)
2022-04-08 09:48:33 +00:00
func (store *MarketDataStore) OnKLineWindowUpdate(cb func(interval types.Interval, klines types.KLineWindow)) {
store.kLineWindowUpdateCallbacks = append(store.kLineWindowUpdateCallbacks, cb)
}
2022-04-08 09:48:33 +00:00
func (store *MarketDataStore) EmitKLineWindowUpdate(interval types.Interval, klines types.KLineWindow) {
for _, cb := range store.kLineWindowUpdateCallbacks {
2022-04-08 09:48:33 +00:00
cb(interval, klines)
}
}
2022-07-20 17:04:49 +00:00
func (store *MarketDataStore) OnKLineClosed(cb func(k types.KLine)) {
store.kLineClosedCallbacks = append(store.kLineClosedCallbacks, cb)
}
func (store *MarketDataStore) EmitKLineClosed(k types.KLine) {
for _, cb := range store.kLineClosedCallbacks {
cb(k)
}
}