mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 17:13:51 +00:00
158 lines
4.0 KiB
Go
158 lines
4.0 KiB
Go
// Code generated by "callbackgen -type WebSocketService"; DO NOT EDIT.
|
|
|
|
package max
|
|
|
|
import (
|
|
"github.com/gorilla/websocket"
|
|
)
|
|
|
|
func (s *WebSocketService) OnConnect(cb func(conn *websocket.Conn)) {
|
|
s.connectCallbacks = append(s.connectCallbacks, cb)
|
|
}
|
|
|
|
func (s *WebSocketService) EmitConnect(conn *websocket.Conn) {
|
|
for _, cb := range s.connectCallbacks {
|
|
cb(conn)
|
|
}
|
|
}
|
|
|
|
func (s *WebSocketService) OnDisconnect(cb func()) {
|
|
s.disconnectCallbacks = append(s.disconnectCallbacks, cb)
|
|
}
|
|
|
|
func (s *WebSocketService) EmitDisconnect() {
|
|
for _, cb := range s.disconnectCallbacks {
|
|
cb()
|
|
}
|
|
}
|
|
|
|
func (s *WebSocketService) OnError(cb func(err error)) {
|
|
s.errorCallbacks = append(s.errorCallbacks, cb)
|
|
}
|
|
|
|
func (s *WebSocketService) EmitError(err error) {
|
|
for _, cb := range s.errorCallbacks {
|
|
cb(err)
|
|
}
|
|
}
|
|
|
|
func (s *WebSocketService) OnMessage(cb func(message []byte)) {
|
|
s.messageCallbacks = append(s.messageCallbacks, cb)
|
|
}
|
|
|
|
func (s *WebSocketService) EmitMessage(message []byte) {
|
|
for _, cb := range s.messageCallbacks {
|
|
cb(message)
|
|
}
|
|
}
|
|
|
|
func (s *WebSocketService) OnBookEvent(cb func(e BookEvent)) {
|
|
s.bookEventCallbacks = append(s.bookEventCallbacks, cb)
|
|
}
|
|
|
|
func (s *WebSocketService) EmitBookEvent(e BookEvent) {
|
|
for _, cb := range s.bookEventCallbacks {
|
|
cb(e)
|
|
}
|
|
}
|
|
|
|
func (s *WebSocketService) OnTradeEvent(cb func(e PublicTradeEvent)) {
|
|
s.tradeEventCallbacks = append(s.tradeEventCallbacks, cb)
|
|
}
|
|
|
|
func (s *WebSocketService) EmitTradeEvent(e PublicTradeEvent) {
|
|
for _, cb := range s.tradeEventCallbacks {
|
|
cb(e)
|
|
}
|
|
}
|
|
|
|
func (s *WebSocketService) OnKLineEvent(cb func(e KLineEvent)) {
|
|
s.kLineEventCallbacks = append(s.kLineEventCallbacks, cb)
|
|
}
|
|
|
|
func (s *WebSocketService) EmitKLineEvent(e KLineEvent) {
|
|
for _, cb := range s.kLineEventCallbacks {
|
|
cb(e)
|
|
}
|
|
}
|
|
|
|
func (s *WebSocketService) OnErrorEvent(cb func(e ErrorEvent)) {
|
|
s.errorEventCallbacks = append(s.errorEventCallbacks, cb)
|
|
}
|
|
|
|
func (s *WebSocketService) EmitErrorEvent(e ErrorEvent) {
|
|
for _, cb := range s.errorEventCallbacks {
|
|
cb(e)
|
|
}
|
|
}
|
|
|
|
func (s *WebSocketService) OnSubscriptionEvent(cb func(e SubscriptionEvent)) {
|
|
s.subscriptionEventCallbacks = append(s.subscriptionEventCallbacks, cb)
|
|
}
|
|
|
|
func (s *WebSocketService) EmitSubscriptionEvent(e SubscriptionEvent) {
|
|
for _, cb := range s.subscriptionEventCallbacks {
|
|
cb(e)
|
|
}
|
|
}
|
|
|
|
func (s *WebSocketService) OnTradeUpdateEvent(cb func(e TradeUpdateEvent)) {
|
|
s.tradeUpdateEventCallbacks = append(s.tradeUpdateEventCallbacks, cb)
|
|
}
|
|
|
|
func (s *WebSocketService) EmitTradeUpdateEvent(e TradeUpdateEvent) {
|
|
for _, cb := range s.tradeUpdateEventCallbacks {
|
|
cb(e)
|
|
}
|
|
}
|
|
|
|
func (s *WebSocketService) OnTradeSnapshotEvent(cb func(e TradeSnapshotEvent)) {
|
|
s.tradeSnapshotEventCallbacks = append(s.tradeSnapshotEventCallbacks, cb)
|
|
}
|
|
|
|
func (s *WebSocketService) EmitTradeSnapshotEvent(e TradeSnapshotEvent) {
|
|
for _, cb := range s.tradeSnapshotEventCallbacks {
|
|
cb(e)
|
|
}
|
|
}
|
|
|
|
func (s *WebSocketService) OnOrderUpdateEvent(cb func(e OrderUpdateEvent)) {
|
|
s.orderUpdateEventCallbacks = append(s.orderUpdateEventCallbacks, cb)
|
|
}
|
|
|
|
func (s *WebSocketService) EmitOrderUpdateEvent(e OrderUpdateEvent) {
|
|
for _, cb := range s.orderUpdateEventCallbacks {
|
|
cb(e)
|
|
}
|
|
}
|
|
|
|
func (s *WebSocketService) OnOrderSnapshotEvent(cb func(e OrderSnapshotEvent)) {
|
|
s.orderSnapshotEventCallbacks = append(s.orderSnapshotEventCallbacks, cb)
|
|
}
|
|
|
|
func (s *WebSocketService) EmitOrderSnapshotEvent(e OrderSnapshotEvent) {
|
|
for _, cb := range s.orderSnapshotEventCallbacks {
|
|
cb(e)
|
|
}
|
|
}
|
|
|
|
func (s *WebSocketService) OnAccountSnapshotEvent(cb func(e AccountSnapshotEvent)) {
|
|
s.accountSnapshotEventCallbacks = append(s.accountSnapshotEventCallbacks, cb)
|
|
}
|
|
|
|
func (s *WebSocketService) EmitAccountSnapshotEvent(e AccountSnapshotEvent) {
|
|
for _, cb := range s.accountSnapshotEventCallbacks {
|
|
cb(e)
|
|
}
|
|
}
|
|
|
|
func (s *WebSocketService) OnAccountUpdateEvent(cb func(e AccountUpdateEvent)) {
|
|
s.accountUpdateEventCallbacks = append(s.accountUpdateEventCallbacks, cb)
|
|
}
|
|
|
|
func (s *WebSocketService) EmitAccountUpdateEvent(e AccountUpdateEvent) {
|
|
for _, cb := range s.accountUpdateEventCallbacks {
|
|
cb(e)
|
|
}
|
|
}
|