types: add trade stats omitempty tag option

This commit is contained in:
c9s 2022-08-12 01:10:52 +08:00
parent df8a4bef93
commit 53b8fd488e
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -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"`