grid2: call bbgo sync api to sync profit stats

This commit is contained in:
c9s 2022-12-15 18:42:25 +08:00
parent 1964763f58
commit c2133a1712
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -1034,7 +1034,11 @@ func (s *Strategy) Run(ctx context.Context, _ bbgo.OrderExecutor, session *bbgo.
orderExecutor.TradeCollector().OnPositionUpdate(func(position *types.Position) { orderExecutor.TradeCollector().OnPositionUpdate(func(position *types.Position) {
bbgo.Sync(ctx, s) bbgo.Sync(ctx, s)
}) })
orderExecutor.ActiveMakerOrders().OnFilled(s.handleOrderFilled) orderExecutor.ActiveMakerOrders().OnFilled(func(o types.Order) {
s.handleOrderFilled(o)
bbgo.Sync(context.Background(), s)
})
s.orderExecutor = orderExecutor s.orderExecutor = orderExecutor
// TODO: detect if there are previous grid orders on the order book // TODO: detect if there are previous grid orders on the order book