display fee only when fee > 0

This commit is contained in:
c9s 2022-01-10 14:25:33 +08:00
parent fb3c198447
commit 7952cf8804

View File

@ -168,11 +168,13 @@ func (p *Position) SlackAttachment() slack.Attachment {
if p.TotalFee != nil { if p.TotalFee != nil {
for feeCurrency, fee := range p.TotalFee { for feeCurrency, fee := range p.TotalFee {
fields = append(fields, slack.AttachmentField{ if fee > 0 {
Title: fmt.Sprintf("Fee (%s)", feeCurrency), fields = append(fields, slack.AttachmentField{
Value: trimTrailingZeroFloat(fee.Float64()), Title: fmt.Sprintf("Fee (%s)", feeCurrency),
Short: true, Value: trimTrailingZeroFloat(fee.Float64()),
}) Short: true,
})
}
} }
} }