mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
feature: prototype of strategy controller struct
This commit is contained in:
parent
5799709e3e
commit
73c2c84cab
|
@ -1 +1,22 @@
|
|||
package bbgo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/c9s/bbgo/pkg/types"
|
||||
)
|
||||
|
||||
type StrategyController struct {
|
||||
status types.StrategyStatus
|
||||
|
||||
SuspendCallbacks []func(ctx context.Context)
|
||||
}
|
||||
|
||||
func (s *StrategyController) OnSuspend(cb func(ctx context.Context)) {
|
||||
s.SuspendCallbacks = append(s.SuspendCallbacks, cb)
|
||||
}
|
||||
|
||||
func (s *StrategyController) EmitKLineClosed(ctx context.Context) {
|
||||
for _, cb := range s.SuspendCallbacks {
|
||||
cb(ctx)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user