mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
bbgo: bind market data store to market data stream when allocating new instance
This commit is contained in:
parent
de62d9dd67
commit
1079757833
|
@ -365,12 +365,17 @@ func (session *ExchangeSession) initSymbol(ctx context.Context, environ *Environ
|
|||
orderStore.BindStream(session.UserDataStream)
|
||||
session.orderStores[symbol] = orderStore
|
||||
|
||||
marketDataStore := NewMarketDataStore(symbol)
|
||||
marketDataStore.BindStream(session.MarketDataStream)
|
||||
session.marketDataStores[symbol] = marketDataStore
|
||||
if _, ok := session.marketDataStores[symbol]; !ok {
|
||||
marketDataStore := NewMarketDataStore(symbol)
|
||||
marketDataStore.BindStream(session.MarketDataStream)
|
||||
session.marketDataStores[symbol] = marketDataStore
|
||||
}
|
||||
|
||||
standardIndicatorSet := NewStandardIndicatorSet(symbol, session.MarketDataStream, marketDataStore)
|
||||
session.standardIndicatorSets[symbol] = standardIndicatorSet
|
||||
if _, ok := session.standardIndicatorSets[symbol]; !ok {
|
||||
marketDataStore := session.marketDataStores[symbol]
|
||||
standardIndicatorSet := NewStandardIndicatorSet(symbol, session.MarketDataStream, marketDataStore)
|
||||
session.standardIndicatorSets[symbol] = standardIndicatorSet
|
||||
}
|
||||
|
||||
// used kline intervals by the given symbol
|
||||
var klineSubscriptions = map[types.Interval]struct{}{}
|
||||
|
@ -475,6 +480,7 @@ func (session *ExchangeSession) MarketDataStore(symbol string) (s *MarketDataSto
|
|||
s, ok = session.marketDataStores[symbol]
|
||||
if !ok {
|
||||
s = NewMarketDataStore(symbol)
|
||||
s.BindStream(session.MarketDataStream)
|
||||
session.marketDataStores[symbol] = s
|
||||
return s, true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user