mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 14:33:53 +00:00
improve/profitStatsTracker: Add a parameter for window to sum up trades
This commit is contained in:
parent
6379cab65e
commit
a74562ed31
|
@ -119,5 +119,6 @@ exchangeStrategies:
|
|||
accumulatedProfitReport:
|
||||
profitMAWindow: 60
|
||||
shortTermProfitWindow: 14
|
||||
accumulateTradeWindow: 30
|
||||
tsvReportPath: res.tsv
|
||||
trackParameters: false
|
||||
|
|
|
@ -25,6 +25,9 @@ type AccumulatedProfitReport struct {
|
|||
|
||||
types.IntervalWindow
|
||||
|
||||
// ProfitMAWindow Accumulated profit SMA window
|
||||
AccumulateTradeWindow int `json:"accumulateTradeWindow"`
|
||||
|
||||
// Accumulated profit
|
||||
accumulatedProfit fixedpoint.Value
|
||||
accumulatedProfitPerInterval *types.Float64Series
|
||||
|
@ -119,7 +122,7 @@ func (r *AccumulatedProfitReport) CsvHeader() []string {
|
|||
"accumulatedFee",
|
||||
"winRatio",
|
||||
"profitFactor",
|
||||
fmt.Sprintf("%s%d Trades", r.Interval, r.Window),
|
||||
fmt.Sprintf("%s%d Trades", r.Interval, r.AccumulateTradeWindow),
|
||||
}
|
||||
|
||||
for i := 0; i < len(r.strategyParameters); i++ {
|
||||
|
@ -143,7 +146,7 @@ func (r *AccumulatedProfitReport) CsvRecords() [][]string {
|
|||
strconv.FormatFloat(r.accumulatedFeePerInterval.Last(i), 'f', 4, 64),
|
||||
strconv.FormatFloat(r.winRatioPerInterval.Last(i), 'f', 4, 64),
|
||||
strconv.FormatFloat(r.profitFactorPerInterval.Last(i), 'f', 4, 64),
|
||||
strconv.FormatFloat(r.accumulatedTradesPerInterval.Last(i), 'f', 4, 64),
|
||||
strconv.FormatFloat(r.accumulatedTradesPerInterval.Last(i)-r.accumulatedTradesPerInterval.Last(i+r.AccumulateTradeWindow), 'f', 4, 64),
|
||||
}
|
||||
for j := 0; j < len(r.strategyParameters); j++ {
|
||||
values = append(values, r.strategyParameters[j][1])
|
||||
|
|
Loading…
Reference in New Issue
Block a user