mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
fix/profitStatsTracker: market is initiated after strategy Subscribe()
This commit is contained in:
parent
2ccce12cbf
commit
4c1639cf00
|
@ -20,8 +20,8 @@ type ProfitStatsTracker struct {
|
||||||
tradeStats *types.TradeStats
|
tradeStats *types.TradeStats
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *ProfitStatsTracker) Subscribe(session *bbgo.ExchangeSession) {
|
func (p *ProfitStatsTracker) Subscribe(session *bbgo.ExchangeSession, symbol string) {
|
||||||
session.Subscribe(types.KLineChannel, p.Market.Symbol, types.SubscribeOptions{Interval: p.Interval})
|
session.Subscribe(types.KLineChannel, symbol, types.SubscribeOptions{Interval: p.Interval})
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitOld is for backward capability. ps is the ProfitStats of the strategy, Market is the strategy Market
|
// InitOld is for backward capability. ps is the ProfitStats of the strategy, Market is the strategy Market
|
||||||
|
|
|
@ -133,7 +133,7 @@ func (s *Strategy) Subscribe(session *bbgo.ExchangeSession) {
|
||||||
|
|
||||||
// Profit tracker
|
// Profit tracker
|
||||||
if s.ProfitStatsTracker != nil {
|
if s.ProfitStatsTracker != nil {
|
||||||
s.ProfitStatsTracker.Subscribe(session)
|
s.ProfitStatsTracker.Subscribe(session, s.Symbol)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user