forked from c9s/bbgo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
strategy_callbacks.go
45 lines (35 loc) · 1006 Bytes
/
strategy_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
// Code generated by "callbackgen -type Strategy"; DO NOT EDIT.
package grid2
import ()
func (s *Strategy) OnGridReady(cb func()) {
s.gridReadyCallbacks = append(s.gridReadyCallbacks, cb)
}
func (s *Strategy) EmitGridReady() {
for _, cb := range s.gridReadyCallbacks {
cb()
}
}
func (s *Strategy) OnGridProfit(cb func(stats *GridProfitStats, profit *GridProfit)) {
s.gridProfitCallbacks = append(s.gridProfitCallbacks, cb)
}
func (s *Strategy) EmitGridProfit(stats *GridProfitStats, profit *GridProfit) {
for _, cb := range s.gridProfitCallbacks {
cb(stats, profit)
}
}
func (s *Strategy) OnGridClosed(cb func()) {
s.gridClosedCallbacks = append(s.gridClosedCallbacks, cb)
}
func (s *Strategy) EmitGridClosed() {
for _, cb := range s.gridClosedCallbacks {
cb()
}
}
func (s *Strategy) OnGridError(cb func(err error)) {
s.gridErrorCallbacks = append(s.gridErrorCallbacks, cb)
}
func (s *Strategy) EmitGridError(err error) {
for _, cb := range s.gridErrorCallbacks {
cb(err)
}
}