Skip to content

Commit

Permalink
FIX: [xalign] add markets to price resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
kbearXD committed Dec 3, 2024
1 parent dea2a74 commit f4e3ea6
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pkg/strategy/xalign/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,17 +456,13 @@ func (s *Strategy) CrossRun(ctx context.Context, _ bbgo.OrderExecutionRouter, se

s.sessions[sessionName] = session

// session.Market(symbol)
for _, market := range session.Markets() {
markets.Add(market)
}
}

s.priceResolver = pricesolver.NewSimplePriceResolver(markets)
for _, session := range s.sessions {
// init the price
marketPrices := session.LastPrices()
for market, price := range marketPrices {
s.priceResolver.Update(market, price)
}

// bind on trade to update price
session.UserDataStream.OnTradeUpdate(s.priceResolver.UpdateFromTrade)
}
Expand Down

0 comments on commit f4e3ea6

Please sign in to comment.