get_lsratio {cryptoQuotes}R Documentation

Get the long to short ratio of a cryptocurrency pair

Description

[Stable]

Get the long-short ratio for any available_tickers() from the available_exchanges()

Usage

## long-short ratio
get_lsratio(
   ticker,
   interval = '1d',
   source   = 'binance',
   from     = NULL,
   to       = NULL,
   top      = FALSE
)

Arguments

ticker

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

interval

A character vector of length 1. See available_intervals() for available intervals.

source

A character-vector of length 1. See available_exchanges() for details.

from

An optional vector of length 1. Can be Sys.Date()-class, Sys.time()-class or as.character() in %Y-%m-%d format.

to

An optional vector of length 1. Can be Sys.Date()-class, Sys.time()-class or as.character() in %Y-%m-%d format.

top

A logical vector. FALSE by default. If TRUE it returns the top traders Long-Short ratios.

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

Available exchanges

See available_exchanges() with for available exchanges.

Limited return values

Binance only supports data for the last 30 days. Use other exchanges if you need beyond that.

Author(s)

Jonas Cuzulan Hirani

See Also

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

Examples

## Not run: 
  # Example on loading
  # long-short ratio
  # for the last days
  # on the 15 minute candle
  # wrapped in try to avoid
  # failure on Github

  # 1) long-short ratio
  # on BTCUSDT pair
  ls_ratio <- cryptoQuotes::get_lsratio(
    ticker = 'BTCUSDT',
    interval = '15m',
    from = Sys.Date() - 1,
    to   = Sys.Date()
  )

  # 2) BTCSDT in same period
  # as the long-short ratio;
  BTC <- cryptoQuotes::get_quote(
    ticker = 'BTCUSDT',
    futures = TRUE,
    interval = '15m',
    from = Sys.Date() - 1,
    to   = Sys.Date()
  )

  # 3) plot BTCUSDT-pair
  # with long-short ratio
  cryptoQuotes::chart(
    ticker = BTC,
    main   = cryptoQuotes::kline(),
    sub    = list(
      cryptoQuotes::lsr(ratio = ls_ratio),
      cryptoQuotes::volume()
    ),
    indicator = list(
      cryptoQuotes::bollinger_bands()
    )
  )

## End(Not run)



# end of scrtipt;

[Package cryptoQuotes version 1.3.0 Index]