xgap: put source market loading to the same code area

This commit is contained in:
c9s 2024-11-16 00:48:27 +08:00
parent 6078b2e144
commit 67a1cd890e
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -132,17 +132,17 @@ func (s *Strategy) CrossRun(ctx context.Context, _ bbgo.OrderExecutionRouter, se
} }
s.sourceSession = sourceSession s.sourceSession = sourceSession
s.sourceMarket, ok = s.sourceSession.Market(s.SourceSymbol)
if !ok {
return fmt.Errorf("source session market %s is not defined", s.Symbol)
}
tradingSession, ok := sessions[s.TradingExchange] tradingSession, ok := sessions[s.TradingExchange]
if !ok { if !ok {
return fmt.Errorf("trading session %s is not defined", s.TradingExchange) return fmt.Errorf("trading session %s is not defined", s.TradingExchange)
} }
s.tradingSession = tradingSession s.tradingSession = tradingSession
s.sourceMarket, ok = s.sourceSession.Market(s.SourceSymbol)
if !ok {
return fmt.Errorf("source session market %s is not defined", s.Symbol)
}
s.tradingMarket, ok = s.tradingSession.Market(s.Symbol) s.tradingMarket, ok = s.tradingSession.Market(s.Symbol)
if !ok { if !ok {
return fmt.Errorf("trading session market %s is not defined", s.Symbol) return fmt.Errorf("trading session market %s is not defined", s.Symbol)