forked from c9s/bbgo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stream_callbacks.go
147 lines (117 loc) · 3.66 KB
/
stream_callbacks.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// Code generated by "callbackgen -type Stream"; DO NOT EDIT.
package max
import (
"github.com/c9s/bbgo/pkg/exchange/max/maxapi"
)
func (s *Stream) OnAuthEvent(cb func(e max.AuthEvent)) {
s.authEventCallbacks = append(s.authEventCallbacks, cb)
}
func (s *Stream) EmitAuthEvent(e max.AuthEvent) {
for _, cb := range s.authEventCallbacks {
cb(e)
}
}
func (s *Stream) OnBookEvent(cb func(e max.BookEvent)) {
s.bookEventCallbacks = append(s.bookEventCallbacks, cb)
}
func (s *Stream) EmitBookEvent(e max.BookEvent) {
for _, cb := range s.bookEventCallbacks {
cb(e)
}
}
func (s *Stream) OnTradeEvent(cb func(e max.PublicTradeEvent)) {
s.tradeEventCallbacks = append(s.tradeEventCallbacks, cb)
}
func (s *Stream) EmitTradeEvent(e max.PublicTradeEvent) {
for _, cb := range s.tradeEventCallbacks {
cb(e)
}
}
func (s *Stream) OnKLineEvent(cb func(e max.KLineEvent)) {
s.kLineEventCallbacks = append(s.kLineEventCallbacks, cb)
}
func (s *Stream) EmitKLineEvent(e max.KLineEvent) {
for _, cb := range s.kLineEventCallbacks {
cb(e)
}
}
func (s *Stream) OnErrorEvent(cb func(e max.ErrorEvent)) {
s.errorEventCallbacks = append(s.errorEventCallbacks, cb)
}
func (s *Stream) EmitErrorEvent(e max.ErrorEvent) {
for _, cb := range s.errorEventCallbacks {
cb(e)
}
}
func (s *Stream) OnSubscriptionEvent(cb func(e max.SubscriptionEvent)) {
s.subscriptionEventCallbacks = append(s.subscriptionEventCallbacks, cb)
}
func (s *Stream) EmitSubscriptionEvent(e max.SubscriptionEvent) {
for _, cb := range s.subscriptionEventCallbacks {
cb(e)
}
}
func (s *Stream) OnTradeUpdateEvent(cb func(e max.TradeUpdateEvent)) {
s.tradeUpdateEventCallbacks = append(s.tradeUpdateEventCallbacks, cb)
}
func (s *Stream) EmitTradeUpdateEvent(e max.TradeUpdateEvent) {
for _, cb := range s.tradeUpdateEventCallbacks {
cb(e)
}
}
func (s *Stream) OnTradeSnapshotEvent(cb func(e max.TradeSnapshotEvent)) {
s.tradeSnapshotEventCallbacks = append(s.tradeSnapshotEventCallbacks, cb)
}
func (s *Stream) EmitTradeSnapshotEvent(e max.TradeSnapshotEvent) {
for _, cb := range s.tradeSnapshotEventCallbacks {
cb(e)
}
}
func (s *Stream) OnOrderUpdateEvent(cb func(e max.OrderUpdateEvent)) {
s.orderUpdateEventCallbacks = append(s.orderUpdateEventCallbacks, cb)
}
func (s *Stream) EmitOrderUpdateEvent(e max.OrderUpdateEvent) {
for _, cb := range s.orderUpdateEventCallbacks {
cb(e)
}
}
func (s *Stream) OnOrderSnapshotEvent(cb func(e max.OrderSnapshotEvent)) {
s.orderSnapshotEventCallbacks = append(s.orderSnapshotEventCallbacks, cb)
}
func (s *Stream) EmitOrderSnapshotEvent(e max.OrderSnapshotEvent) {
for _, cb := range s.orderSnapshotEventCallbacks {
cb(e)
}
}
func (s *Stream) OnAdRatioEvent(cb func(e max.ADRatioEvent)) {
s.adRatioEventCallbacks = append(s.adRatioEventCallbacks, cb)
}
func (s *Stream) EmitAdRatioEvent(e max.ADRatioEvent) {
for _, cb := range s.adRatioEventCallbacks {
cb(e)
}
}
func (s *Stream) OnDebtEvent(cb func(e max.DebtEvent)) {
s.debtEventCallbacks = append(s.debtEventCallbacks, cb)
}
func (s *Stream) EmitDebtEvent(e max.DebtEvent) {
for _, cb := range s.debtEventCallbacks {
cb(e)
}
}
func (s *Stream) OnAccountSnapshotEvent(cb func(e max.AccountSnapshotEvent)) {
s.accountSnapshotEventCallbacks = append(s.accountSnapshotEventCallbacks, cb)
}
func (s *Stream) EmitAccountSnapshotEvent(e max.AccountSnapshotEvent) {
for _, cb := range s.accountSnapshotEventCallbacks {
cb(e)
}
}
func (s *Stream) OnAccountUpdateEvent(cb func(e max.AccountUpdateEvent)) {
s.accountUpdateEventCallbacks = append(s.accountUpdateEventCallbacks, cb)
}
func (s *Stream) EmitAccountUpdateEvent(e max.AccountUpdateEvent) {
for _, cb := range s.accountUpdateEventCallbacks {
cb(e)
}
}