add JSON method to the pnl report

This commit is contained in:
c9s 2021-12-06 00:47:41 +08:00
parent 0c6055a201
commit 1e151a170a

View File

@ -1,6 +1,7 @@
package pnl
import (
"encoding/json"
"strconv"
"time"
@ -30,6 +31,10 @@ type AverageCostPnlReport struct {
CurrencyFees map[string]float64 `json:"currencyFees,omitempty"`
}
func (report *AverageCostPnlReport) JSON() ([]byte, error) {
return json.MarshalIndent(report, "", " ")
}
func (report AverageCostPnlReport) Print() {
log.Infof("TRADES SINCE: %v", report.StartTime)
log.Infof("NUMBER OF TRADES: %d", report.NumTrades)