bbgo_origin/pkg/exchange/okex/stream_callbacks.go

44 lines
870 B
Go

// Code generated by "callbackgen -type Stream -interface"; DO NOT EDIT.
package okex
import ()
func (s *Stream) OnCancelData(cb func()) {
s.cancelDataCallbacks = append(s.cancelDataCallbacks, cb)
}
func (s *Stream) EmitCancelData() {
for _, cb := range s.cancelDataCallbacks {
cb()
}
}
func (s *Stream) OnBookData(cb func(data BookData)) {
s.bookDataCallbacks = append(s.bookDataCallbacks, cb)
}
func (s *Stream) EmitBookData(data BookData) {
for _, cb := range s.bookDataCallbacks {
cb(data)
}
}
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)
}
}
type StreamEventHub interface {
OnCancelData(cb func())
OnBookData(cb func(data BookData))
OnEvent(cb func(event WebSocketEvent))
}