make markets field private

This commit is contained in:
c9s 2020-10-18 12:30:13 +08:00
parent dab264a4ad
commit f826bb014a
2 changed files with 5 additions and 5 deletions

View File

@ -71,7 +71,7 @@ func (environ *Environment) Init(ctx context.Context) (err error) {
return err
}
session.Markets = markets
session.markets = markets
for symbol := range loadedSymbols {
log.Infof("syncing trades from %s for symbol %s...", session.Exchange.Name(), symbol)

View File

@ -21,8 +21,8 @@ type ExchangeSession struct {
Exchange types.Exchange
// Markets defines market configuration of a symbol
Markets map[string]types.Market
// markets defines market configuration of a symbol
markets map[string]types.Market
lastPrices map[string]float64
@ -38,7 +38,7 @@ func NewExchangeSession(name string, exchange types.Exchange) *ExchangeSession {
Name: name,
Exchange: exchange,
Subscriptions: make(map[types.Subscription]types.Subscription),
Markets: make(map[string]types.Market),
markets: make(map[string]types.Market),
Trades: make(map[string][]types.Trade),
lastPrices: make(map[string]float64),
marketDataStores: make(map[string]*store.MarketDataStore),
@ -56,7 +56,7 @@ func (session *ExchangeSession) LastPrice(symbol string) (price float64, ok bool
}
func (session *ExchangeSession) Market(symbol string) (market types.Market, ok bool) {
market, ok = session.Markets[symbol]
market, ok = session.markets[symbol]
return market, ok
}