mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
improve/supertrend: Switch of outputting patameters in profit report
This commit is contained in:
parent
6b55936e62
commit
bc4eae5e39
|
@ -120,3 +120,4 @@ exchangeStrategies:
|
||||||
profitMAWindow: 60
|
profitMAWindow: 60
|
||||||
shortTermProfitWindow: 14
|
shortTermProfitWindow: 14
|
||||||
tsvReportPath: res.tsv
|
tsvReportPath: res.tsv
|
||||||
|
trackParameters: false
|
||||||
|
|
|
@ -39,7 +39,9 @@ type Strategy struct {
|
||||||
ProfitStats *types.ProfitStats `persistence:"profit_stats"`
|
ProfitStats *types.ProfitStats `persistence:"profit_stats"`
|
||||||
TradeStats *types.TradeStats `persistence:"trade_stats"`
|
TradeStats *types.TradeStats `persistence:"trade_stats"`
|
||||||
|
|
||||||
|
// ProfitStatsTracker tracks profit related status and generates report
|
||||||
ProfitStatsTracker *report.ProfitStatsTracker `json:"profitStatsTracker"`
|
ProfitStatsTracker *report.ProfitStatsTracker `json:"profitStatsTracker"`
|
||||||
|
TrackParameters bool `json:"trackParameters"`
|
||||||
|
|
||||||
// Symbol is the market symbol you want to trade
|
// Symbol is the market symbol you want to trade
|
||||||
Symbol string `json:"symbol"`
|
Symbol string `json:"symbol"`
|
||||||
|
@ -362,7 +364,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add strategy parameters to report
|
// Add strategy parameters to report
|
||||||
if s.ProfitStatsTracker.AccumulatedProfitReport != nil {
|
if s.TrackParameters && s.ProfitStatsTracker.AccumulatedProfitReport != nil {
|
||||||
s.ProfitStatsTracker.AccumulatedProfitReport.AddStrategyParameter("window", fmt.Sprintf("%d", s.Window))
|
s.ProfitStatsTracker.AccumulatedProfitReport.AddStrategyParameter("window", fmt.Sprintf("%d", s.Window))
|
||||||
s.ProfitStatsTracker.AccumulatedProfitReport.AddStrategyParameter("multiplier", fmt.Sprintf("%f", s.SupertrendMultiplier))
|
s.ProfitStatsTracker.AccumulatedProfitReport.AddStrategyParameter("multiplier", fmt.Sprintf("%f", s.SupertrendMultiplier))
|
||||||
s.ProfitStatsTracker.AccumulatedProfitReport.AddStrategyParameter("fastDEMA", fmt.Sprintf("%d", s.FastDEMAWindow))
|
s.ProfitStatsTracker.AccumulatedProfitReport.AddStrategyParameter("fastDEMA", fmt.Sprintf("%d", s.FastDEMAWindow))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user