Skip to content

Commit 633bcea

Browse files
authored
Merge pull request #2595 from c9s/dboy/xfundingv2/slack-avg-fee
FEATURE: [xfundingv2] add average funding income to Slack attachment
2 parents 3b6a9d7 + aa1a1e1 commit 633bcea

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

pkg/strategy/xfundingv2/round.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,19 @@ func (n *roundNotification) SlackAttachment() slack.Attachment {
444444
fields = append(fields, unrealizedPnLFields(unrealizedPnL)...)
445445
}
446446
}
447+
if len(n.ArbitrageRound.syncState.FundingFeeRecords) > 0 {
448+
feeIncomeTotal := fixedpoint.Zero
449+
numRecords := fixedpoint.Zero
450+
for _, fee := range n.ArbitrageRound.syncState.FundingFeeRecords {
451+
feeIncomeTotal = feeIncomeTotal.Add(fee.Amount)
452+
numRecords = numRecords.Add(fixedpoint.One)
453+
}
454+
fields = append(fields, slack.AttachmentField{
455+
Title: "Average Funding Income",
456+
Value: feeIncomeTotal.Div(numRecords).String(),
457+
Short: true,
458+
})
459+
}
447460

448461
fields = append(fields, []slack.AttachmentField{
449462
{

0 commit comments

Comments
 (0)