Skip to content

Commit

Permalink
xmaker: bind price solver with market data stream
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Sep 27, 2024
1 parent 93334b5 commit 61c4c4d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/strategy/xmaker/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,6 @@ func (s *Strategy) CrossRun(

// initialize the price resolver
sourceMarkets := s.sourceSession.Markets()
s.priceSolver = pricesolver.NewSimplePriceResolver(sourceMarkets)

makerSession, ok := sessions[s.MakerExchange]
if !ok {
Expand Down Expand Up @@ -1475,6 +1474,9 @@ func (s *Strategy) CrossRun(
})
}

s.priceSolver = pricesolver.NewSimplePriceResolver(sourceMarkets)
s.priceSolver.BindStream(s.sourceSession.MarketDataStream)

s.sourceSession.MarketDataStream.OnKLineClosed(types.KLineWith(s.Symbol, types.Interval1m, func(k types.KLine) {
s.priceSolver.Update(k.Symbol, k.Close)
feeToken := s.sourceSession.Exchange.PlatformFeeCurrency()
Expand Down

0 comments on commit 61c4c4d

Please sign in to comment.