fundingrate

package
v1.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrFundingRateOutsideLimits is returned when a funding rate is outside the allowed date range
	ErrFundingRateOutsideLimits = errors.New("funding rate outside limits")
	// ErrPaymentCurrencyCannotBeEmpty is returned when a payment currency is not set
	ErrPaymentCurrencyCannotBeEmpty = errors.New("payment currency cannot be empty")
	// ErrNoFundingRatesFound is returned when no funding rates are found
	ErrNoFundingRatesFound = errors.New("no funding rates found")
)

Functions

This section is empty.

Types

type HistoricalRates

type HistoricalRates struct {
	Exchange              string
	Asset                 asset.Item
	Pair                  currency.Pair
	StartDate             time.Time
	EndDate               time.Time
	LatestRate            Rate
	PredictedUpcomingRate Rate
	FundingRates          []Rate
	PaymentSum            decimal.Decimal
	PaymentCurrency       currency.Code
	TimeOfNextRate        time.Time
}

HistoricalRates is used to return funding rate details for a position

type HistoricalRatesRequest

type HistoricalRatesRequest struct {
	Asset asset.Item
	Pair  currency.Pair
	// PaymentCurrency is an optional parameter depending on exchange API
	// if you are paid in a currency that isn't easily inferred from the Pair,
	// eg BTCUSD-PERP use this field
	PaymentCurrency      currency.Code
	StartDate            time.Time
	EndDate              time.Time
	IncludePayments      bool
	IncludePredictedRate bool
	// RespectHistoryLimits if an exchange has a limit on rate history lookup
	// and your start date is beyond that time, this will set your start date
	// to the maximum allowed date rather than give you errors
	RespectHistoryLimits bool
}

HistoricalRatesRequest is used to request funding rate details for a position

type LatestRateRequest

type LatestRateRequest struct {
	Asset                asset.Item
	Pair                 currency.Pair
	IncludePredictedRate bool
}

LatestRateRequest is used to request the latest funding rate

type LatestRateResponse

type LatestRateResponse struct {
	Exchange              string
	Asset                 asset.Item
	Pair                  currency.Pair
	LatestRate            Rate
	PredictedUpcomingRate Rate
	TimeOfNextRate        time.Time
	TimeChecked           time.Time
}

LatestRateResponse for when you just want the latest rate

type Rate

type Rate struct {
	Time    time.Time
	Rate    decimal.Decimal
	Payment decimal.Decimal
}

Rate holds details for an individual funding rate

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL