get_openinterest {cryptoQuotes}R Documentation

Get the open interest on perpetual futures contracts

Description

[Stable]

Get the open interest on a cryptocurrency pair from the available_exchanges() in any actively traded available_tickers() on the FUTURES markets.

Usage

## open interest
get_openinterest(
 ticker,
 interval = '1d',
 source   = 'binance',
 from     = NULL,
 to       = NULL
)

Arguments

ticker

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

interval

A character-vector of length 1. ⁠1d⁠ by default. See available_intervals() for available intervals.

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.

Details

On time-zones and dates

Values passed to from or to must be coercible by as.Date(), or as.POSIXct(), with a format of either "%Y-%m-%d" or "%Y-%m-%d %H:%M:%S". By default all dates are passed and returned with Sys.timezone().

On returns

If only from is provided 200 pips are returned up to Sys.time(). If only to is provided 200 pips up to the specified date is returned.

Value

An xts-object containing,

Note

Not all exchanges supports this endpoint, check available_exchanges() for details.

Author(s)

Serkan Korkmaz

See Also

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

Examples

## Not run: 
  # script: Open Interest Example
  # date: 2024-03-03
  # author: Serkan Korkmaz, serkor1@duck.com
  # objective: Fetch
  # funding rate from one of the available
  # exchanges
  # script start;

  # 1) check available
  # exchanges for open interest
  available_exchanges(type = 'interest')

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

  # script end;

## End(Not run)


[Package cryptoQuotes version 1.3.0 Index]