adjust slack attachment

This commit is contained in:
c9s 2020-08-06 23:49:47 +08:00
parent 5ffd751701
commit 8281ec33cb
2 changed files with 5 additions and 8 deletions

View File

@ -168,9 +168,8 @@ func (report ProfitAndLossReport) SlackAttachment() slack.Attachment {
// Pretext: "",
// Text: "",
Fields: []slack.AttachmentField{
{Title: "Symbol", Value: report.Symbol, Short: true},
{Title: "Profit", Value: USD.FormatMoney(report.Profit), Short: true},
{Title: "Unrealized Profit", Value: USD.FormatMoney(report.UnrealizedProfit), Short: true},
{Title: "Profit", Value: USD.FormatMoney(report.Profit)},
{Title: "Unrealized Profit", Value: USD.FormatMoney(report.UnrealizedProfit)},
{Title: "Current Price", Value: market.FormatPrice(report.CurrentPrice), Short: true},
{Title: "Average Cost", Value: market.FormatPrice(report.AverageBidCost), Short: true},
{Title: "Fee (USD)", Value: USD.FormatMoney(report.FeeUSD), Short: true},

View File

@ -38,24 +38,22 @@ func (trade Trade) SlackAttachment() slack.Attachment {
market, ok := FindMarket(trade.Symbol)
if !ok {
return slack.Attachment{
Title: fmt.Sprintf("%s %s Trade", trade.Symbol, trade.Side),
Title: fmt.Sprintf("*%s* %s Trade", trade.Symbol, trade.Side),
Color: color,
}
}
return slack.Attachment{
Title: fmt.Sprintf("%s %s Trade", trade.Symbol, trade.Side),
Title: fmt.Sprintf("*%s* %s Trade", trade.Symbol, trade.Side),
Color: color,
// Pretext: "",
// Text: "",
Fields: []slack.AttachmentField{
{Title: "Symbol", Value: trade.Symbol, Short: true},
{Title: "Side", Value: trade.Side, Short: true},
{Title: "Price", Value: market.FormatPrice(trade.Price), Short: true},
{Title: "Volume", Value: market.FormatVolume(trade.Quantity), Short: true},
{Title: "Amount", Value: market.FormatPrice(trade.QuoteQuantity)},
{Title: "FeeCurrency", Value: trade.FeeCurrency, Short: true},
{Title: "Fee", Value: util.FormatFloat(trade.Fee, 4), Short: true},
{Title: "FeeCurrency", Value: trade.FeeCurrency, Short: true},
},
// Footer: tradingCtx.TradeStartTime.Format(time.RFC822),
// FooterIcon: "",