diff --git a/config/xfunding.yaml b/config/xfunding.yaml index efada033d..e18576c9a 100644 --- a/config/xfunding.yaml +++ b/config/xfunding.yaml @@ -54,7 +54,7 @@ crossExchangeStrategies: ## shortFundingRate is the funding rate range you want to create your position shortFundingRate: ## when funding rate is higher than this high value, the strategy will start buying spot and opening a short position - high: 0.001% + high: 0.0005% ## when funding rate is lower than this low value, the strategy will start closing futures position and sell the spot low: -0.01% diff --git a/pkg/strategy/xfunding/fundingfee.go b/pkg/strategy/xfunding/fundingfee.go new file mode 100644 index 000000000..a07fad0c6 --- /dev/null +++ b/pkg/strategy/xfunding/fundingfee.go @@ -0,0 +1,29 @@ +package xfunding + +import ( + "fmt" + "time" + + "github.com/slack-go/slack" + + "github.com/c9s/bbgo/pkg/fixedpoint" + "github.com/c9s/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)), + } +} diff --git a/pkg/strategy/xfunding/profitstats.go b/pkg/strategy/xfunding/profitstats.go index 93e3b6df9..c8eb58af8 100644 --- a/pkg/strategy/xfunding/profitstats.go +++ b/pkg/strategy/xfunding/profitstats.go @@ -8,13 +8,6 @@ import ( "github.com/c9s/bbgo/pkg/types" ) -type FundingFee struct { - Asset string `json:"asset"` - Amount fixedpoint.Value `json:"amount"` - Txn int64 `json:"txn"` - Time time.Time `json:"time"` -} - type ProfitStats struct { *types.ProfitStats