bbgo_origin/exchange/max/maxapi/websocketservice_callbacks.go

148 lines
3.8 KiB
Go
Raw Normal View History

2020-10-01 08:48:08 +00:00
// Code generated by "callbackgen -type WebSocketService"; DO NOT EDIT.
2020-10-01 08:07:18 +00:00
package max
2020-10-02 04:43:14 +00:00
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(conn *websocket.Conn)) {
s.disconnectCallbacks = append(s.disconnectCallbacks, cb)
}
func (s *WebSocketService) EmitDisconnect(conn *websocket.Conn) {
for _, cb := range s.disconnectCallbacks {
cb(conn)
}
}
2020-10-01 08:07:18 +00:00
2020-10-01 08:48:08 +00:00
func (s *WebSocketService) OnError(cb func(err error)) {
2020-10-01 08:07:18 +00:00
s.errorCallbacks = append(s.errorCallbacks, cb)
}
2020-10-01 08:48:08 +00:00
func (s *WebSocketService) EmitError(err error) {
2020-10-01 08:07:18 +00:00
for _, cb := range s.errorCallbacks {
cb(err)
}
}
2020-10-01 08:48:08 +00:00
func (s *WebSocketService) OnMessage(cb func(message []byte)) {
2020-10-01 08:07:18 +00:00
s.messageCallbacks = append(s.messageCallbacks, cb)
}
2020-10-01 08:48:08 +00:00
func (s *WebSocketService) EmitMessage(message []byte) {
2020-10-01 08:07:18 +00:00
for _, cb := range s.messageCallbacks {
cb(message)
}
}
2020-10-01 08:48:08 +00:00
func (s *WebSocketService) OnBookEvent(cb func(e BookEvent)) {
2020-10-01 08:07:18 +00:00
s.bookEventCallbacks = append(s.bookEventCallbacks, cb)
}
2020-10-01 08:48:08 +00:00
func (s *WebSocketService) EmitBookEvent(e BookEvent) {
2020-10-01 08:07:18 +00:00
for _, cb := range s.bookEventCallbacks {
cb(e)
}
}
2020-10-02 13:29:56 +00:00
func (s *WebSocketService) OnTradeEvent(cb func(e PublicTradeEvent)) {
2020-10-01 08:07:18 +00:00
s.tradeEventCallbacks = append(s.tradeEventCallbacks, cb)
}
2020-10-02 13:29:56 +00:00
func (s *WebSocketService) EmitTradeEvent(e PublicTradeEvent) {
2020-10-01 08:07:18 +00:00
for _, cb := range s.tradeEventCallbacks {
cb(e)
}
}
2020-10-01 08:48:08 +00:00
func (s *WebSocketService) OnErrorEvent(cb func(e ErrorEvent)) {
2020-10-01 08:07:18 +00:00
s.errorEventCallbacks = append(s.errorEventCallbacks, cb)
}
2020-10-01 08:48:08 +00:00
func (s *WebSocketService) EmitErrorEvent(e ErrorEvent) {
2020-10-01 08:07:18 +00:00
for _, cb := range s.errorEventCallbacks {
cb(e)
}
}
2020-10-01 08:48:08 +00:00
func (s *WebSocketService) OnSubscriptionEvent(cb func(e SubscriptionEvent)) {
2020-10-01 08:07:18 +00:00
s.subscriptionEventCallbacks = append(s.subscriptionEventCallbacks, cb)
}
2020-10-01 08:48:08 +00:00
func (s *WebSocketService) EmitSubscriptionEvent(e SubscriptionEvent) {
2020-10-01 08:07:18 +00:00
for _, cb := range s.subscriptionEventCallbacks {
cb(e)
}
}
2020-10-02 13:29:56 +00:00
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)
}
}