mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
improve/profitStatsTracker: use strconv instead of Sprintf()
This commit is contained in:
parent
2a80d708af
commit
928a77cb8b
|
@ -7,6 +7,7 @@ import (
|
||||||
"github.com/c9s/bbgo/pkg/fixedpoint"
|
"github.com/c9s/bbgo/pkg/fixedpoint"
|
||||||
"github.com/c9s/bbgo/pkg/indicator"
|
"github.com/c9s/bbgo/pkg/indicator"
|
||||||
"github.com/c9s/bbgo/pkg/types"
|
"github.com/c9s/bbgo/pkg/types"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AccumulatedProfitReport For accumulated profit report output
|
// AccumulatedProfitReport For accumulated profit report output
|
||||||
|
@ -135,15 +136,15 @@ func (r *AccumulatedProfitReport) Output() {
|
||||||
// Output data row
|
// Output data row
|
||||||
for i := 0; i <= r.Window-1; i++ {
|
for i := 0; i <= r.Window-1; i++ {
|
||||||
values := []string{
|
values := []string{
|
||||||
fmt.Sprintf("%d", i+1),
|
strconv.Itoa(i + 1),
|
||||||
r.symbol,
|
r.symbol,
|
||||||
fmt.Sprintf("%f", r.accumulatedProfitPerInterval.Last(i)),
|
strconv.FormatFloat(r.accumulatedProfitPerInterval.Last(i), 'f', 4, 64),
|
||||||
fmt.Sprintf("%f", r.profitMAPerInterval.Last(i)),
|
strconv.FormatFloat(r.profitMAPerInterval.Last(i), 'f', 4, 64),
|
||||||
fmt.Sprintf("%f", r.accumulatedProfitPerInterval.Last(i)-r.accumulatedProfitPerInterval.Last(i+r.ShortTermProfitWindow)),
|
strconv.FormatFloat(r.accumulatedProfitPerInterval.Last(i)-r.accumulatedProfitPerInterval.Last(i+r.ShortTermProfitWindow), 'f', 4, 64),
|
||||||
fmt.Sprintf("%f", r.accumulatedFeePerInterval.Last(i)),
|
strconv.FormatFloat(r.accumulatedFeePerInterval.Last(i), 'f', 4, 64),
|
||||||
fmt.Sprintf("%f", r.winRatioPerInterval.Last(i)),
|
strconv.FormatFloat(r.winRatioPerInterval.Last(i), 'f', 4, 64),
|
||||||
fmt.Sprintf("%f", r.profitFactorPerInterval.Last(i)),
|
strconv.FormatFloat(r.profitFactorPerInterval.Last(i), 'f', 4, 64),
|
||||||
fmt.Sprintf("%f", r.accumulatedTradesPerInterval.Last(i)),
|
strconv.FormatFloat(r.accumulatedTradesPerInterval.Last(i), 'f', 4, 64),
|
||||||
}
|
}
|
||||||
for j := 0; j < len(r.strategyParameters); j++ {
|
for j := 0; j < len(r.strategyParameters); j++ {
|
||||||
values = append(values, r.strategyParameters[j][1])
|
values = append(values, r.strategyParameters[j][1])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user