lsr {cryptoQuotes}R Documentation

Chart the long-short ratios

Description

[Experimental]

The lsr()-function adds a scatter plot as a subplot to the chart colored by ratio size.

Usage

lsr(ratio, internal = list())

Arguments

ratio

A xts::xts()-object with the column LSRatio. See get_lsratio() for more details.

internal

An empty list(). This is an internal helper-argument, ignore.

Details

The long-short ratio is a market sentiment indicator on expected price movement.

Value

A plotly::plot_ly()-object wrapped in rlang::expr()

See Also

Other chart indicators: add_event(), alma(), bollinger_bands(), chart(), dema(), ema(), evwma(), fgi(), hma(), macd(), rsi(), sma(), volume(), vwap(), wma(), zlema()

Other sentiment indicators: fgi()

Other subcharts: add_event(), fgi(), macd(), rsi(), volume()

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]