bbgo/pkg/exchange/kucoin/stream_callbacks.go

66 lines
1.8 KiB
Go

// Code generated by "callbackgen -type Stream -interface"; DO NOT EDIT.
package kucoin
func (s *Stream) OnCandleEvent(cb func(candle *WebSocketCandleEvent, e *WebSocketEvent)) {
s.candleEventCallbacks = append(s.candleEventCallbacks, cb)
}
func (s *Stream) EmitCandleEvent(candle *WebSocketCandleEvent, e *WebSocketEvent) {
for _, cb := range s.candleEventCallbacks {
cb(candle, e)
}
}
func (s *Stream) OnOrderBookL2Event(cb func(e *WebSocketOrderBookL2Event)) {
s.orderBookL2EventCallbacks = append(s.orderBookL2EventCallbacks, cb)
}
func (s *Stream) EmitOrderBookL2Event(e *WebSocketOrderBookL2Event) {
for _, cb := range s.orderBookL2EventCallbacks {
cb(e)
}
}
func (s *Stream) OnTickerEvent(cb func(e *WebSocketTickerEvent)) {
s.tickerEventCallbacks = append(s.tickerEventCallbacks, cb)
}
func (s *Stream) EmitTickerEvent(e *WebSocketTickerEvent) {
for _, cb := range s.tickerEventCallbacks {
cb(e)
}
}
func (s *Stream) OnAccountBalanceEvent(cb func(e *WebSocketAccountBalanceEvent)) {
s.accountBalanceEventCallbacks = append(s.accountBalanceEventCallbacks, cb)
}
func (s *Stream) EmitAccountBalanceEvent(e *WebSocketAccountBalanceEvent) {
for _, cb := range s.accountBalanceEventCallbacks {
cb(e)
}
}
func (s *Stream) OnPrivateOrderEvent(cb func(e *WebSocketPrivateOrderEvent)) {
s.privateOrderEventCallbacks = append(s.privateOrderEventCallbacks, cb)
}
func (s *Stream) EmitPrivateOrderEvent(e *WebSocketPrivateOrderEvent) {
for _, cb := range s.privateOrderEventCallbacks {
cb(e)
}
}
type StreamEventHub interface {
OnCandleEvent(cb func(candle *WebSocketCandleEvent, e *WebSocketEvent))
OnOrderBookL2Event(cb func(e *WebSocketOrderBookL2Event))
OnTickerEvent(cb func(e *WebSocketTickerEvent))
OnAccountBalanceEvent(cb func(e *WebSocketAccountBalanceEvent))
OnPrivateOrderEvent(cb func(e *WebSocketPrivateOrderEvent))
}