techsignal: if it's already high funding rate, do not show change

This commit is contained in:
c9s 2021-11-06 15:23:52 +08:00
parent a2c2646a16
commit 7a3963b34e

View File

@ -107,28 +107,30 @@ func (s *Strategy) listenToFundingRate(ctx context.Context, exchange *binance.Ex
fundingRate := index.LastFundingRate
if fundingRate >= s.FundingRate.High {
s.Notifiability.Notify("%s funding rate is too high! current %s > threshold %s",
s.Notifiability.Notify("%s funding rate %s is too high! threshold %s",
s.Symbol,
fundingRate.Percentage(),
s.FundingRate.High.Percentage(),
)
}
} else {
if previousIndex != nil {
if s.FundingRate.DiffThreshold == 0 {
// 0.6%
s.FundingRate.DiffThreshold = fixedpoint.NewFromFloat(0.006 * 0.01)
}
if previousIndex != nil {
if s.FundingRate.DiffThreshold == 0 {
s.FundingRate.DiffThreshold = fixedpoint.NewFromFloat(0.005 * 0.01)
}
diff := fundingRate - previousIndex.LastFundingRate
if diff.Abs() > s.FundingRate.DiffThreshold {
s.Notifiability.Notify("%s funding rate changed %s, current funding rate %s",
s.Symbol,
diff.SignedPercentage(),
fundingRate.Percentage(),
)
diff := fundingRate - previousIndex.LastFundingRate
if diff.Abs() > s.FundingRate.DiffThreshold {
s.Notifiability.Notify("%s funding rate changed %s, current funding rate %s",
s.Symbol,
diff.SignedPercentage(),
fundingRate.Percentage(),
)
}
}
}
previousIndex = index
if fundingRate24HoursLowIndex != nil {
if fundingRate24HoursLowIndex.Time.Before(time.Now().Add(24 * time.Hour)) {