From 53b8fd488e80f41efe152cf17f847d683005f373 Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 12 Aug 2022 01:10:52 +0800 Subject: [PATCH] types: add trade stats omitempty tag option --- pkg/types/trade_stats.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/types/trade_stats.go b/pkg/types/trade_stats.go index de6f203a4..2d49aec1d 100644 --- a/pkg/types/trade_stats.go +++ b/pkg/types/trade_stats.go @@ -141,7 +141,7 @@ func (s IntervalProfitCollector) MarshalYAML() (interface{}, error) { // TODO: Add more stats from the reference: // See https://www.metatrader5.com/en/terminal/help/algotrading/testing_report type TradeStats struct { - Symbol string `json:"symbol"` + Symbol string `json:"symbol,omitempty"` WinningRatio fixedpoint.Value `json:"winningRatio" yaml:"winningRatio"` NumOfLossTrade int `json:"numOfLossTrade" yaml:"numOfLossTrade"` @@ -150,8 +150,8 @@ type TradeStats struct { GrossProfit fixedpoint.Value `json:"grossProfit" yaml:"grossProfit"` GrossLoss fixedpoint.Value `json:"grossLoss" yaml:"grossLoss"` - Profits []fixedpoint.Value `json:"profits" yaml:"profits"` - Losses []fixedpoint.Value `json:"losses" yaml:"losses"` + Profits []fixedpoint.Value `json:"profits,omitempty" yaml:"profits,omitempty"` + Losses []fixedpoint.Value `json:"losses,omitempty" yaml:"losses,omitempty"` LargestProfitTrade fixedpoint.Value `json:"largestProfitTrade,omitempty" yaml:"largestProfitTrade"` LargestLossTrade fixedpoint.Value `json:"largestLossTrade,omitempty" yaml:"largestLossTrade"`