mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 00:05:15 +00:00
improve/profitStatsTracker: rename InitOld() to InitLegacy()
This commit is contained in:
parent
928a77cb8b
commit
1a90cd0322
|
@ -25,8 +25,8 @@ func (p *ProfitStatsTracker) Subscribe(session *bbgo.ExchangeSession, symbol str
|
||||||
session.Subscribe(types.KLineChannel, 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
|
// InitLegacy 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) {
|
func (p *ProfitStatsTracker) InitLegacy(market types.Market, ps **types.ProfitStats, ts *types.TradeStats) {
|
||||||
p.Market = market
|
p.Market = market
|
||||||
|
|
||||||
if *ps == nil {
|
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
|
// Init initialize the tracker with the given Market
|
||||||
func (p *ProfitStatsTracker) Init(market types.Market, ts *types.TradeStats) {
|
func (p *ProfitStatsTracker) Init(market types.Market, ts *types.TradeStats) {
|
||||||
ps := types.NewProfitStats(p.Market)
|
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) {
|
func (p *ProfitStatsTracker) Bind(session *bbgo.ExchangeSession, tradeCollector *core.TradeCollector) {
|
||||||
|
|
|
@ -358,7 +358,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
||||||
// Setup profit tracker
|
// Setup profit tracker
|
||||||
if s.ProfitStatsTracker != nil {
|
if s.ProfitStatsTracker != nil {
|
||||||
if s.ProfitStatsTracker.CurrentProfitStats == 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
|
// Add strategy parameters to report
|
||||||
|
|
Loading…
Reference in New Issue
Block a user