mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-15 19:43:53 +00:00
28 lines
591 B
Go
28 lines
591 B
Go
// Code generated by "callbackgen -type Strategy"; DO NOT EDIT.
|
|
|
|
package dca2
|
|
|
|
import (
|
|
"github.com/c9s/bbgo/pkg/types"
|
|
)
|
|
|
|
func (s *Strategy) OnPosition(cb func(*types.Position)) {
|
|
s.positionCallbacks = append(s.positionCallbacks, cb)
|
|
}
|
|
|
|
func (s *Strategy) EmitPosition(position *types.Position) {
|
|
for _, cb := range s.positionCallbacks {
|
|
cb(position)
|
|
}
|
|
}
|
|
|
|
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)
|
|
}
|
|
}
|