improve/profitStatsTracker: rename InitOld() to InitLegacy()

This commit is contained in:
Andy Cheng 2023-07-11 10:24:07 +08:00
parent feb9f3a2d5
commit 561c332541
No known key found for this signature in database
GPG Key ID: 936427CF651A9D28
2 changed files with 4 additions and 4 deletions

View File

@ -25,8 +25,8 @@ func (p *ProfitStatsTracker) Subscribe(session *bbgo.ExchangeSession, symbol str
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
func (p *ProfitStatsTracker) InitOld(market types.Market, ps **types.ProfitStats, ts *types.TradeStats) {
// InitLegacy is for backward capability. ps is the ProfitStats of the strategy, Market is the strategy Market
func (p *ProfitStatsTracker) InitLegacy(market types.Market, ps **types.ProfitStats, ts *types.TradeStats) {
p.Market = market
if *ps == nil {
@ -46,7 +46,7 @@ func (p *ProfitStatsTracker) InitOld(market types.Market, ps **types.ProfitStats
// Init initialize the tracker with the given Market
func (p *ProfitStatsTracker) Init(market types.Market, ts *types.TradeStats) {
ps := types.NewProfitStats(p.Market)
p.InitOld(market, &ps, ts)
p.InitLegacy(market, &ps, ts)
}
func (p *ProfitStatsTracker) Bind(session *bbgo.ExchangeSession, tradeCollector *core.TradeCollector) {

View File

@ -358,7 +358,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
// Setup profit tracker
if s.ProfitStatsTracker != nil {
if s.ProfitStatsTracker.CurrentProfitStats == nil {
s.ProfitStatsTracker.InitOld(s.Market, &s.ProfitStats, s.TradeStats)
s.ProfitStatsTracker.InitLegacy(s.Market, &s.ProfitStats, s.TradeStats)
}
// Add strategy parameters to report