mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-11 01:23:51 +00:00
66 lines
1.6 KiB
Go
66 lines
1.6 KiB
Go
|
// Code generated by "callbackgen -type PublicWebSocketService"; DO NOT EDIT.
|
||
|
|
||
|
package max
|
||
|
|
||
|
import ()
|
||
|
|
||
|
func (s *PublicWebSocketService) OnError(cb func(err error)) {
|
||
|
s.errorCallbacks = append(s.errorCallbacks, cb)
|
||
|
}
|
||
|
|
||
|
func (s *PublicWebSocketService) EmitError(err error) {
|
||
|
for _, cb := range s.errorCallbacks {
|
||
|
cb(err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (s *PublicWebSocketService) OnMessage(cb func(message []byte)) {
|
||
|
s.messageCallbacks = append(s.messageCallbacks, cb)
|
||
|
}
|
||
|
|
||
|
func (s *PublicWebSocketService) EmitMessage(message []byte) {
|
||
|
for _, cb := range s.messageCallbacks {
|
||
|
cb(message)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (s *PublicWebSocketService) OnBookEvent(cb func(e BookEvent)) {
|
||
|
s.bookEventCallbacks = append(s.bookEventCallbacks, cb)
|
||
|
}
|
||
|
|
||
|
func (s *PublicWebSocketService) EmitBookEvent(e BookEvent) {
|
||
|
for _, cb := range s.bookEventCallbacks {
|
||
|
cb(e)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (s *PublicWebSocketService) OnTradeEvent(cb func(e TradeEvent)) {
|
||
|
s.tradeEventCallbacks = append(s.tradeEventCallbacks, cb)
|
||
|
}
|
||
|
|
||
|
func (s *PublicWebSocketService) EmitTradeEvent(e TradeEvent) {
|
||
|
for _, cb := range s.tradeEventCallbacks {
|
||
|
cb(e)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (s *PublicWebSocketService) OnErrorEvent(cb func(e ErrorEvent)) {
|
||
|
s.errorEventCallbacks = append(s.errorEventCallbacks, cb)
|
||
|
}
|
||
|
|
||
|
func (s *PublicWebSocketService) EmitErrorEvent(e ErrorEvent) {
|
||
|
for _, cb := range s.errorEventCallbacks {
|
||
|
cb(e)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (s *PublicWebSocketService) OnSubscriptionEvent(cb func(e SubscriptionEvent)) {
|
||
|
s.subscriptionEventCallbacks = append(s.subscriptionEventCallbacks, cb)
|
||
|
}
|
||
|
|
||
|
func (s *PublicWebSocketService) EmitSubscriptionEvent(e SubscriptionEvent) {
|
||
|
for _, cb := range s.subscriptionEventCallbacks {
|
||
|
cb(e)
|
||
|
}
|
||
|
}
|