bbgo_origin/pkg/strategy/grid2/strategy_callbacks.go

46 lines
1006 B
Go
Raw Normal View History

2022-12-26 10:15:39 +00:00
// 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()
}
}
2023-01-10 12:15:51 +00:00
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)
}
}