Learn R Programming

cryptoQuotes (version 1.3.0)

get_fundingrate: Get the funding rate on futures contracts

Description

[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
)

Value

An xts-object containing,

  • funding_rate (numeric): the current funding rate

Arguments

ticker

An 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.

Author

Serkan Korkmaz

See Also

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

Examples

Run this code
if (FALSE) {
# script: Funding Rate example
# date: 2024-03-01
# author: Serkan Korkmaz, serkor1@duck.com
# objective: Fetch
# funding rate from one of the available
# exchanges
# script start;

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

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

Run the code above in your browser using DataLab