mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +00:00
add callbacks
This commit is contained in:
parent
8acada76a9
commit
6df72d54a8
25
pkg/types/rbtorderbook_callbacks.go
Normal file
25
pkg/types/rbtorderbook_callbacks.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
// Code generated by "callbackgen -type RBTOrderBook"; DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
import ()
|
||||
|
||||
func (b *RBTOrderBook) OnLoad(cb func(book *RBTOrderBook)) {
|
||||
b.loadCallbacks = append(b.loadCallbacks, cb)
|
||||
}
|
||||
|
||||
func (b *RBTOrderBook) EmitLoad(book *RBTOrderBook) {
|
||||
for _, cb := range b.loadCallbacks {
|
||||
cb(book)
|
||||
}
|
||||
}
|
||||
|
||||
func (b *RBTOrderBook) OnUpdate(cb func(book *RBTOrderBook)) {
|
||||
b.updateCallbacks = append(b.updateCallbacks, cb)
|
||||
}
|
||||
|
||||
func (b *RBTOrderBook) EmitUpdate(book *RBTOrderBook) {
|
||||
for _, cb := range b.updateCallbacks {
|
||||
cb(book)
|
||||
}
|
||||
}
|
25
pkg/types/sliceorderbook_callbacks.go
Normal file
25
pkg/types/sliceorderbook_callbacks.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
// Code generated by "callbackgen -type SliceOrderBook"; DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
import ()
|
||||
|
||||
func (b *SliceOrderBook) OnLoad(cb func(book *SliceOrderBook)) {
|
||||
b.loadCallbacks = append(b.loadCallbacks, cb)
|
||||
}
|
||||
|
||||
func (b *SliceOrderBook) EmitLoad(book *SliceOrderBook) {
|
||||
for _, cb := range b.loadCallbacks {
|
||||
cb(book)
|
||||
}
|
||||
}
|
||||
|
||||
func (b *SliceOrderBook) OnUpdate(cb func(book *SliceOrderBook)) {
|
||||
b.updateCallbacks = append(b.updateCallbacks, cb)
|
||||
}
|
||||
|
||||
func (b *SliceOrderBook) EmitUpdate(book *SliceOrderBook) {
|
||||
for _, cb := range b.updateCallbacks {
|
||||
cb(book)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user