Skip to contents

[Stable]

Get the funding rate on a cryptocurrency pair from the available_exchanges() in any actively traded available_tickers() on the futures markets.

Usage

get_fundingrate(
 ticker,
 source   = 'binance',
 from     = NULL,
 to       = NULL
)

Arguments

ticker

A character-vector of length 1. See available_tickers() for available tickers.

source

A character-vector of length 1. binance by default. See available_exchanges() for available exchanges.

from

An optional character-, date- or POSIXct-vector of length 1. NULL by default.

to

An optional character-, date- or POSIXct-vector of length 1. NULL by default.

Value

An <[xts]>-object containing,

index

<POSIXct> the time-index

funding_rate

<numeric> the current funding rate

Sample output

#>                     funding_rate
#> 2024-03-09 17:00:00   0.00026407
#> 2024-03-10 01:00:00   0.00031010
#> 2024-03-10 09:00:00   0.00063451
#> 2024-03-10 17:00:00   0.00054479
#> 2024-03-11 01:00:00   0.00035489
#> 2024-03-11 09:00:00   0.00078428

See also

Other get-functions: get_fgindex(), get_lsratio(), get_openinterest(), get_quote()

Author

Serkan Korkmaz

Examples

if (FALSE) { # \dontrun{
# script start;

# 1) check available
# exchanges for funding rates
cryptoQuotes::available_exchanges(
  type = "fundingrate"
  )

# 2) get BTC funding rate
# for the last 7 days
tail(
  BTC <- cryptoQuotes::get_fundingrate(
    ticker = "BTCUSDT",
    source = "binance",
    from   = Sys.Date() - 7
  )
)

# script end;
} # }