mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45: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)
|
orderStore.BindStream(session.UserDataStream)
|
||||||
session.orderStores[symbol] = orderStore
|
session.orderStores[symbol] = orderStore
|
||||||
|
|
||||||
marketDataStore := NewMarketDataStore(symbol)
|
if _, ok := session.marketDataStores[symbol]; !ok {
|
||||||
marketDataStore.BindStream(session.MarketDataStream)
|
marketDataStore := NewMarketDataStore(symbol)
|
||||||
session.marketDataStores[symbol] = marketDataStore
|
marketDataStore.BindStream(session.MarketDataStream)
|
||||||
|
session.marketDataStores[symbol] = marketDataStore
|
||||||
|
}
|
||||||
|
|
||||||
standardIndicatorSet := NewStandardIndicatorSet(symbol, session.MarketDataStream, marketDataStore)
|
if _, ok := session.standardIndicatorSets[symbol]; !ok {
|
||||||
session.standardIndicatorSets[symbol] = standardIndicatorSet
|
marketDataStore := session.marketDataStores[symbol]
|
||||||
|
standardIndicatorSet := NewStandardIndicatorSet(symbol, session.MarketDataStream, marketDataStore)
|
||||||
|
session.standardIndicatorSets[symbol] = standardIndicatorSet
|
||||||
|
}
|
||||||
|
|
||||||
// used kline intervals by the given symbol
|
// used kline intervals by the given symbol
|
||||||
var klineSubscriptions = map[types.Interval]struct{}{}
|
var klineSubscriptions = map[types.Interval]struct{}{}
|
||||||
|
@ -475,6 +480,7 @@ func (session *ExchangeSession) MarketDataStore(symbol string) (s *MarketDataSto
|
||||||
s, ok = session.marketDataStores[symbol]
|
s, ok = session.marketDataStores[symbol]
|
||||||
if !ok {
|
if !ok {
|
||||||
s = NewMarketDataStore(symbol)
|
s = NewMarketDataStore(symbol)
|
||||||
|
s.BindStream(session.MarketDataStream)
|
||||||
session.marketDataStores[symbol] = s
|
session.marketDataStores[symbol] = s
|
||||||
return s, true
|
return s, true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user