mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
rename callback
This commit is contained in:
parent
547e9ece8f
commit
b6e7c48fd5
|
@ -100,8 +100,8 @@ type Strategy struct {
|
|||
|
||||
// callbacks
|
||||
common.StatusCallbacks
|
||||
profitCallbacks []func(*ProfitStats)
|
||||
positionCallbacks []func(*types.Position)
|
||||
profitCallbacks []func(*ProfitStats)
|
||||
positionUpdateCallbacks []func(*types.Position)
|
||||
}
|
||||
|
||||
func (s *Strategy) ID() string {
|
||||
|
@ -232,7 +232,7 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
|
|||
s.updateTakeProfitPrice()
|
||||
|
||||
// emit position update
|
||||
s.EmitPosition(position)
|
||||
s.EmitPositionUpdate(position)
|
||||
})
|
||||
|
||||
s.OrderExecutor.ActiveMakerOrders().OnFilled(func(o types.Order) {
|
||||
|
|
|
@ -16,12 +16,12 @@ func (s *Strategy) EmitProfit(profitStats *ProfitStats) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *Strategy) OnPosition(cb func(*types.Position)) {
|
||||
s.positionCallbacks = append(s.positionCallbacks, cb)
|
||||
func (s *Strategy) OnPositionUpdate(cb func(*types.Position)) {
|
||||
s.positionUpdateCallbacks = append(s.positionUpdateCallbacks, cb)
|
||||
}
|
||||
|
||||
func (s *Strategy) EmitPosition(position *types.Position) {
|
||||
for _, cb := range s.positionCallbacks {
|
||||
func (s *Strategy) EmitPositionUpdate(position *types.Position) {
|
||||
for _, cb := range s.positionUpdateCallbacks {
|
||||
cb(position)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user