xdepthmaker: fix use of uninitialized vars

This commit is contained in:
c9s 2024-03-06 16:10:22 +08:00
parent 38a155d9a1
commit f5873172de
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -325,18 +325,23 @@ func (s *Strategy) CrossRun(
}
fixer := NewProfitFixer(s.makerMarket)
fixer.AddExchange(s.makerSession.Name, s.makerSession.Exchange.(types.ExchangeTradeHistoryService))
fixer.AddExchange(s.hedgeSession.Name, s.hedgeSession.Exchange.(types.ExchangeTradeHistoryService))
fixer.AddExchange(makerSession.Name, makerSession.Exchange.(types.ExchangeTradeHistoryService))
fixer.AddExchange(hedgeSession.Name, hedgeSession.Exchange.(types.ExchangeTradeHistoryService))
s.CrossExchangeMarketMakingStrategy.Position = types.NewPositionFromMarket(s.makerMarket)
s.CrossExchangeMarketMakingStrategy.ProfitStats = types.NewProfitStats(s.makerMarket)
makerMarket, _ := s.makerSession.Market(s.Symbol)
s.CrossExchangeMarketMakingStrategy.Position = types.NewPositionFromMarket(makerMarket)
s.CrossExchangeMarketMakingStrategy.ProfitStats = types.NewProfitStats(makerMarket)
if err2 := fixer.Fix(ctx, s.ProfitFixerConfig.TradesSince.Time(), time.Now(), s.CrossExchangeMarketMakingStrategy.ProfitStats, s.CrossExchangeMarketMakingStrategy.Position); err2 != nil {
return err2
}
}
if err := s.CrossExchangeMarketMakingStrategy.Initialize(ctx, s.Environment, makerSession, hedgeSession, s.Symbol, ID, s.InstanceID()); err != nil {
if err := s.CrossExchangeMarketMakingStrategy.Initialize(ctx,
s.Environment,
makerSession,
hedgeSession,
s.Symbol, ID, s.InstanceID()); err != nil {
return err
}