bbgo/pkg/strategy/xfunding/fundingfee.go

30 lines
739 B
Go

package xfunding
import (
"fmt"
"time"
"github.com/slack-go/slack"
"git.qtrade.icu/lychiyu/bbgo/pkg/fixedpoint"
"git.qtrade.icu/lychiyu/bbgo/pkg/style"
)
type FundingFee struct {
Asset string `json:"asset"`
Amount fixedpoint.Value `json:"amount"`
Txn int64 `json:"txn"`
Time time.Time `json:"time"`
}
func (f *FundingFee) SlackAttachment() slack.Attachment {
return slack.Attachment{
Title: "Funding Fee " + fmt.Sprintf("%s %s", style.PnLSignString(f.Amount), f.Asset),
Color: style.PnLColor(f.Amount),
// Pretext: "",
// Text: text,
Fields: []slack.AttachmentField{},
Footer: fmt.Sprintf("Transation ID: %d Transaction Time %s", f.Txn, f.Time.Format(time.RFC822)),
}
}