bbgo_origin/pkg/strategy/grid2/strategy_callbacks.go
2023-01-10 20:15:51 +08:00

46 lines
1006 B
Go

// 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)
}
}