mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +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
|
Status types.StrategyStatus
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
SuspendCallbacks []func()
|
suspendCallbacks []func()
|
||||||
ResumeCallbacks []func()
|
resumeCallbacks []func()
|
||||||
EmergencyStopCallbacks []func()
|
emergencyStopCallbacks []func()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StrategyController) GetStatus() types.StrategyStatus {
|
func (s *StrategyController) GetStatus() types.StrategyStatus {
|
||||||
|
|
|
@ -5,31 +5,31 @@ package bbgo
|
||||||
import ()
|
import ()
|
||||||
|
|
||||||
func (s *StrategyController) OnSuspend(cb func()) {
|
func (s *StrategyController) OnSuspend(cb func()) {
|
||||||
s.SuspendCallbacks = append(s.SuspendCallbacks, cb)
|
s.suspendCallbacks = append(s.suspendCallbacks, cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StrategyController) EmitSuspend() {
|
func (s *StrategyController) EmitSuspend() {
|
||||||
for _, cb := range s.SuspendCallbacks {
|
for _, cb := range s.suspendCallbacks {
|
||||||
cb()
|
cb()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StrategyController) OnResume(cb func()) {
|
func (s *StrategyController) OnResume(cb func()) {
|
||||||
s.ResumeCallbacks = append(s.ResumeCallbacks, cb)
|
s.resumeCallbacks = append(s.resumeCallbacks, cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StrategyController) EmitResume() {
|
func (s *StrategyController) EmitResume() {
|
||||||
for _, cb := range s.ResumeCallbacks {
|
for _, cb := range s.resumeCallbacks {
|
||||||
cb()
|
cb()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StrategyController) OnEmergencyStop(cb func()) {
|
func (s *StrategyController) OnEmergencyStop(cb func()) {
|
||||||
s.EmergencyStopCallbacks = append(s.EmergencyStopCallbacks, cb)
|
s.emergencyStopCallbacks = append(s.emergencyStopCallbacks, cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StrategyController) EmitEmergencyStop() {
|
func (s *StrategyController) EmitEmergencyStop() {
|
||||||
for _, cb := range s.EmergencyStopCallbacks {
|
for _, cb := range s.emergencyStopCallbacks {
|
||||||
cb()
|
cb()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user