mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
feature: make callback vars start with lowercase
This commit is contained in:
parent
61b6755518
commit
6b62f27155
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user