bbgo_origin/pkg/exchange/okex/stream_callbacks.go

44 lines
915 B
Go
Raw Normal View History

2021-05-26 17:07:38 +00:00
// Code generated by "callbackgen -type Stream -interface"; DO NOT EDIT.
package okex
import ()
func (s *Stream) OnCandleData(cb func(candle Candle)) {
s.candleDataCallbacks = append(s.candleDataCallbacks, cb)
2021-05-26 17:07:38 +00:00
}
func (s *Stream) EmitCandleData(candle Candle) {
for _, cb := range s.candleDataCallbacks {
cb(candle)
2021-05-26 17:07:38 +00:00
}
}
func (s *Stream) OnBookData(cb func(book BookData)) {
s.bookDataCallbacks = append(s.bookDataCallbacks, cb)
}
func (s *Stream) EmitBookData(book BookData) {
for _, cb := range s.bookDataCallbacks {
cb(book)
}
}
func (s *Stream) OnEvent(cb func(event WebSocketEvent)) {
s.eventCallbacks = append(s.eventCallbacks, cb)
}
func (s *Stream) EmitEvent(event WebSocketEvent) {
for _, cb := range s.eventCallbacks {
cb(event)
}
}
2021-05-26 17:07:38 +00:00
type StreamEventHub interface {
OnCandleData(cb func(candle Candle))
OnBookData(cb func(book BookData))
OnEvent(cb func(event WebSocketEvent))
2021-05-26 17:07:38 +00:00
}