From 6b62f271555cf43aa0d05ba5eb5cb21342c74a53 Mon Sep 17 00:00:00 2001 From: Andy Cheng Date: Mon, 25 Apr 2022 18:39:32 +0800 Subject: [PATCH] feature: make callback vars start with lowercase --- pkg/bbgo/strategy_controller.go | 6 +++--- pkg/bbgo/strategycontroller_callbacks.go | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/bbgo/strategy_controller.go b/pkg/bbgo/strategy_controller.go index 7e9638823..e9e866258 100644 --- a/pkg/bbgo/strategy_controller.go +++ b/pkg/bbgo/strategy_controller.go @@ -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 { diff --git a/pkg/bbgo/strategycontroller_callbacks.go b/pkg/bbgo/strategycontroller_callbacks.go index 6df7446b7..caa3e68fb 100644 --- a/pkg/bbgo/strategycontroller_callbacks.go +++ b/pkg/bbgo/strategycontroller_callbacks.go @@ -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() } }