Skip to content

Commit

Permalink
xdepthmaker: run profit fixer before s.CrossExchangeMarketMakingStrat…
Browse files Browse the repository at this point in the history
…egy.Initialize
  • Loading branch information
c9s committed Mar 6, 2024
1 parent ac43937 commit 31676cc
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions pkg/strategy/xdepthmaker/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,19 +319,6 @@ func (s *Strategy) CrossRun(

log.Infof("makerSession: %s hedgeSession: %s", makerSession.Name, hedgeSession.Name)

if err := s.CrossExchangeMarketMakingStrategy.Initialize(ctx, s.Environment, makerSession, hedgeSession, s.Symbol, ID, s.InstanceID()); err != nil {
return err
}

s.pricingBook = types.NewStreamBook(s.Symbol)
s.pricingBook.BindStream(s.hedgeSession.MarketDataStream)

s.stopC = make(chan struct{})

s.authedC = make(chan struct{}, 5)
bindAuthSignal(ctx, s.makerSession.UserDataStream, s.authedC)
bindAuthSignal(ctx, s.hedgeSession.UserDataStream, s.authedC)

if s.ProfitFixerConfig != nil {
if s.ProfitFixerConfig.TradesSince.Time().IsZero() {
return errors.New("tradesSince time can not be zero")
Expand All @@ -349,6 +336,19 @@ func (s *Strategy) CrossRun(
}
}

if err := s.CrossExchangeMarketMakingStrategy.Initialize(ctx, s.Environment, makerSession, hedgeSession, s.Symbol, ID, s.InstanceID()); err != nil {
return err
}

s.pricingBook = types.NewStreamBook(s.Symbol)
s.pricingBook.BindStream(s.hedgeSession.MarketDataStream)

s.stopC = make(chan struct{})

s.authedC = make(chan struct{}, 5)
bindAuthSignal(ctx, s.makerSession.UserDataStream, s.authedC)
bindAuthSignal(ctx, s.hedgeSession.UserDataStream, s.authedC)

if s.RecoverTrade {
go s.runTradeRecover(ctx)
}
Expand Down

0 comments on commit 31676cc

Please sign in to comment.