mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-14 02:53:50 +00:00
28 lines
621 B
Go
28 lines
621 B
Go
// Code generated by "callbackgen -type Strategy"; DO NOT EDIT.
|
|
|
|
package dca2
|
|
|
|
import (
|
|
"github.com/c9s/bbgo/pkg/types"
|
|
)
|
|
|
|
func (s *Strategy) OnProfit(cb func(*ProfitStats)) {
|
|
s.profitCallbacks = append(s.profitCallbacks, cb)
|
|
}
|
|
|
|
func (s *Strategy) EmitProfit(profitStats *ProfitStats) {
|
|
for _, cb := range s.profitCallbacks {
|
|
cb(profitStats)
|
|
}
|
|
}
|
|
|
|
func (s *Strategy) OnPositionUpdate(cb func(*types.Position)) {
|
|
s.positionUpdateCallbacks = append(s.positionUpdateCallbacks, cb)
|
|
}
|
|
|
|
func (s *Strategy) EmitPositionUpdate(position *types.Position) {
|
|
for _, cb := range s.positionUpdateCallbacks {
|
|
cb(position)
|
|
}
|
|
}
|