feature: make callback vars start with lowercase

This commit is contained in:
Andy Cheng 2022-04-25 18:39:32 +08:00
parent 61b6755518
commit 6b62f27155
2 changed files with 9 additions and 9 deletions

View File

@ -9,9 +9,9 @@ type StrategyController struct {
Status types.StrategyStatus
// Callbacks
SuspendCallbacks []func()
ResumeCallbacks []func()
EmergencyStopCallbacks []func()
suspendCallbacks []func()
resumeCallbacks []func()
emergencyStopCallbacks []func()
}
func (s *StrategyController) GetStatus() types.StrategyStatus {

View File

@ -5,31 +5,31 @@ package bbgo
import ()
func (s *StrategyController) OnSuspend(cb func()) {
s.SuspendCallbacks = append(s.SuspendCallbacks, cb)
s.suspendCallbacks = append(s.suspendCallbacks, cb)
}
func (s *StrategyController) EmitSuspend() {
for _, cb := range s.SuspendCallbacks {
for _, cb := range s.suspendCallbacks {
cb()
}
}
func (s *StrategyController) OnResume(cb func()) {
s.ResumeCallbacks = append(s.ResumeCallbacks, cb)
s.resumeCallbacks = append(s.resumeCallbacks, cb)
}
func (s *StrategyController) EmitResume() {
for _, cb := range s.ResumeCallbacks {
for _, cb := range s.resumeCallbacks {
cb()
}
}
func (s *StrategyController) OnEmergencyStop(cb func()) {
s.EmergencyStopCallbacks = append(s.EmergencyStopCallbacks, cb)
s.emergencyStopCallbacks = append(s.emergencyStopCallbacks, cb)
}
func (s *StrategyController) EmitEmergencyStop() {
for _, cb := range s.EmergencyStopCallbacks {
for _, cb := range s.emergencyStopCallbacks {
cb()
}
}