Merge pull request #1471 from c9s/c9s/add-DisableMarketDataStore-option

FEATURE: add DisableMarketDataStore option
This commit is contained in:
c9s 2023-12-26 12:01:42 +08:00 committed by GitHub
commit f4941bef74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 7 deletions

View File

@ -335,6 +335,9 @@ type EnvironmentConfig struct {
DisableStartupBalanceQuery bool `json:"disableStartupBalanceQuery"`
DisableSessionTradeBuffer bool `json:"disableSessionTradeBuffer"`
DisableMarketDataStore bool `json:"disableMarketDataStore"`
MaxSessionTradeBufferSize int `json:"maxSessionTradeBufferSize"`
}

View File

@ -405,6 +405,7 @@ func (session *ExchangeSession) initSymbol(ctx context.Context, environ *Environ
return fmt.Errorf("market %s is not defined", symbol)
}
disableMarketDataStore := environ.environmentConfig != nil && environ.environmentConfig.DisableMarketDataStore
disableSessionTradeBuffer := environ.environmentConfig != nil && environ.environmentConfig.DisableSessionTradeBuffer
maxSessionTradeBufferSize := 0
if environ.environmentConfig != nil && environ.environmentConfig.MaxSessionTradeBufferSize > 0 {
@ -441,13 +442,13 @@ func (session *ExchangeSession) initSymbol(ctx context.Context, environ *Environ
orderStore.BindStream(session.UserDataStream)
session.orderStores[symbol] = orderStore
if _, ok := session.marketDataStores[symbol]; !ok {
marketDataStore := NewMarketDataStore(symbol)
if !disableMarketDataStore {
if _, ok := session.marketDataStores[symbol]; !ok {
marketDataStore.BindStream(session.MarketDataStream)
session.marketDataStores[symbol] = marketDataStore
}
marketDataStore := session.marketDataStores[symbol]
}
session.marketDataStores[symbol] = marketDataStore
if _, ok := session.standardIndicatorSets[symbol]; !ok {
standardIndicatorSet := NewStandardIndicatorSet(symbol, session.MarketDataStream, marketDataStore)