bbgo_origin/pkg/bbgo/strategycontroller_callbacks.go

44 lines
876 B
Go
Raw Permalink Normal View History

2022-06-17 07:04:23 +00:00
// Code generated by "callbackgen -type StrategyController -interface"; DO NOT EDIT.
2022-04-21 09:54:16 +00:00
package bbgo
import ()
func (s *StrategyController) OnSuspend(cb func()) {
s.suspendCallbacks = append(s.suspendCallbacks, cb)
2022-04-21 09:54:16 +00:00
}
func (s *StrategyController) EmitSuspend() {
for _, cb := range s.suspendCallbacks {
2022-04-21 09:54:16 +00:00
cb()
}
}
func (s *StrategyController) OnResume(cb func()) {
s.resumeCallbacks = append(s.resumeCallbacks, cb)
2022-04-21 09:54:16 +00:00
}
func (s *StrategyController) EmitResume() {
for _, cb := range s.resumeCallbacks {
2022-04-21 09:54:16 +00:00
cb()
}
}
func (s *StrategyController) OnEmergencyStop(cb func()) {
s.emergencyStopCallbacks = append(s.emergencyStopCallbacks, cb)
2022-04-21 09:54:16 +00:00
}
func (s *StrategyController) EmitEmergencyStop() {
for _, cb := range s.emergencyStopCallbacks {
2022-04-21 09:54:16 +00:00
cb()
}
}
2022-06-17 07:04:23 +00:00
type StrategyControllerEventHub interface {
OnSuspend(cb func())
OnResume(cb func())
OnEmergencyStop(cb func())
}