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: // TODO: Add more stats from the reference:
// See https://www.metatrader5.com/en/terminal/help/algotrading/testing_report // See https://www.metatrader5.com/en/terminal/help/algotrading/testing_report
type TradeStats struct { type TradeStats struct {
Symbol string `json:"symbol"` Symbol string `json:"symbol,omitempty"`
WinningRatio fixedpoint.Value `json:"winningRatio" yaml:"winningRatio"` WinningRatio fixedpoint.Value `json:"winningRatio" yaml:"winningRatio"`
NumOfLossTrade int `json:"numOfLossTrade" yaml:"numOfLossTrade"` NumOfLossTrade int `json:"numOfLossTrade" yaml:"numOfLossTrade"`
@ -150,8 +150,8 @@ type TradeStats struct {
GrossProfit fixedpoint.Value `json:"grossProfit" yaml:"grossProfit"` GrossProfit fixedpoint.Value `json:"grossProfit" yaml:"grossProfit"`
GrossLoss fixedpoint.Value `json:"grossLoss" yaml:"grossLoss"` GrossLoss fixedpoint.Value `json:"grossLoss" yaml:"grossLoss"`
Profits []fixedpoint.Value `json:"profits" yaml:"profits"` Profits []fixedpoint.Value `json:"profits,omitempty" yaml:"profits,omitempty"`
Losses []fixedpoint.Value `json:"losses" yaml:"losses"` Losses []fixedpoint.Value `json:"losses,omitempty" yaml:"losses,omitempty"`
LargestProfitTrade fixedpoint.Value `json:"largestProfitTrade,omitempty" yaml:"largestProfitTrade"` LargestProfitTrade fixedpoint.Value `json:"largestProfitTrade,omitempty" yaml:"largestProfitTrade"`
LargestLossTrade fixedpoint.Value `json:"largestLossTrade,omitempty" yaml:"largestLossTrade"` LargestLossTrade fixedpoint.Value `json:"largestLossTrade,omitempty" yaml:"largestLossTrade"`