mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 08:15:15 +00:00
add json tag for AverageCostPnlReport
This commit is contained in:
parent
3615477d8f
commit
0c6055a201
|
@ -13,32 +13,34 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type AverageCostPnlReport struct {
|
type AverageCostPnlReport struct {
|
||||||
CurrentPrice float64
|
LastPrice float64 `json:"lastPrice"`
|
||||||
StartTime time.Time
|
StartTime time.Time `json:"startTime"`
|
||||||
Symbol string
|
Symbol string `json:"symbol"`
|
||||||
Market types.Market
|
Market types.Market `json:"market"`
|
||||||
|
|
||||||
NumTrades int
|
NumTrades int `json:"numTrades"`
|
||||||
Profit, NetProfit, UnrealizedProfit fixedpoint.Value
|
Profit fixedpoint.Value `json:"profit"`
|
||||||
AverageBidCost float64
|
NetProfit fixedpoint.Value `json:"netProfit"`
|
||||||
BuyVolume float64
|
UnrealizedProfit fixedpoint.Value `json:"unrealizedProfit"`
|
||||||
SellVolume float64
|
AverageCost float64 `json:"averageCost,omitempty"`
|
||||||
FeeInUSD float64
|
BuyVolume float64 `json:"buyVolume,omitempty"`
|
||||||
Stock float64
|
SellVolume float64 `json:"sellVolume,omitempty"`
|
||||||
CurrencyFees map[string]float64
|
FeeInUSD float64 `json:"feeInUSD,omitempty"`
|
||||||
|
Stock float64 `json:"stock,omitempty"`
|
||||||
|
CurrencyFees map[string]float64 `json:"currencyFees,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (report AverageCostPnlReport) Print() {
|
func (report AverageCostPnlReport) Print() {
|
||||||
log.Infof("TRADES SINCE: %v", report.StartTime)
|
log.Infof("TRADES SINCE: %v", report.StartTime)
|
||||||
log.Infof("NUMBER OF TRADES: %d", report.NumTrades)
|
log.Infof("NUMBER OF TRADES: %d", report.NumTrades)
|
||||||
log.Infof("AVERAGE COST: %s", types.USD.FormatMoneyFloat64(report.AverageBidCost))
|
log.Infof("AVERAGE COST: %s", types.USD.FormatMoneyFloat64(report.AverageCost))
|
||||||
log.Infof("TOTAL BUY VOLUME: %f", report.BuyVolume)
|
log.Infof("TOTAL BUY VOLUME: %f", report.BuyVolume)
|
||||||
log.Infof("TOTAL SELL VOLUME: %f", report.SellVolume)
|
log.Infof("TOTAL SELL VOLUME: %f", report.SellVolume)
|
||||||
log.Infof("STOCK: %f", report.Stock)
|
log.Infof("STOCK: %f", report.Stock)
|
||||||
|
|
||||||
// FIXME:
|
// FIXME:
|
||||||
// log.Infof("FEE (USD): %f", report.FeeInUSD)
|
// log.Infof("FEE (USD): %f", report.FeeInUSD)
|
||||||
log.Infof("CURRENT PRICE: %s", types.USD.FormatMoneyFloat64(report.CurrentPrice))
|
log.Infof("CURRENT PRICE: %s", types.USD.FormatMoneyFloat64(report.LastPrice))
|
||||||
log.Infof("CURRENCY FEES:")
|
log.Infof("CURRENCY FEES:")
|
||||||
for currency, fee := range report.CurrencyFees {
|
for currency, fee := range report.CurrencyFees {
|
||||||
log.Infof(" - %s: %f", currency, fee)
|
log.Infof(" - %s: %f", currency, fee)
|
||||||
|
@ -63,8 +65,8 @@ func (report AverageCostPnlReport) SlackAttachment() slack.Attachment {
|
||||||
Fields: []slack.AttachmentField{
|
Fields: []slack.AttachmentField{
|
||||||
{Title: "Profit", Value: types.USD.FormatMoney(report.Profit)},
|
{Title: "Profit", Value: types.USD.FormatMoney(report.Profit)},
|
||||||
{Title: "Unrealized Profit", Value: types.USD.FormatMoney(report.UnrealizedProfit)},
|
{Title: "Unrealized Profit", Value: types.USD.FormatMoney(report.UnrealizedProfit)},
|
||||||
{Title: "Current Price", Value: report.Market.FormatPrice(report.CurrentPrice), Short: true},
|
{Title: "Current Price", Value: report.Market.FormatPrice(report.LastPrice), Short: true},
|
||||||
{Title: "Average Cost", Value: report.Market.FormatPrice(report.AverageBidCost), Short: true},
|
{Title: "Average Cost", Value: report.Market.FormatPrice(report.AverageCost), Short: true},
|
||||||
|
|
||||||
// FIXME:
|
// FIXME:
|
||||||
// {Title: "Fee (USD)", Value: types.USD.FormatMoney(report.FeeInUSD), Short: true},
|
// {Title: "Fee (USD)", Value: types.USD.FormatMoney(report.FeeInUSD), Short: true},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user