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()) {
|
2022-04-25 10:39:32 +00:00
|
|
|
s.suspendCallbacks = append(s.suspendCallbacks, cb)
|
2022-04-21 09:54:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *StrategyController) EmitSuspend() {
|
2022-04-25 10:39:32 +00:00
|
|
|
for _, cb := range s.suspendCallbacks {
|
2022-04-21 09:54:16 +00:00
|
|
|
cb()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *StrategyController) OnResume(cb func()) {
|
2022-04-25 10:39:32 +00:00
|
|
|
s.resumeCallbacks = append(s.resumeCallbacks, cb)
|
2022-04-21 09:54:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *StrategyController) EmitResume() {
|
2022-04-25 10:39:32 +00:00
|
|
|
for _, cb := range s.resumeCallbacks {
|
2022-04-21 09:54:16 +00:00
|
|
|
cb()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *StrategyController) OnEmergencyStop(cb func()) {
|
2022-04-25 10:39:32 +00:00
|
|
|
s.emergencyStopCallbacks = append(s.emergencyStopCallbacks, cb)
|
2022-04-21 09:54:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *StrategyController) EmitEmergencyStop() {
|
2022-04-25 10:39:32 +00:00
|
|
|
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())
|
|
|
|
}
|