getLSRatio {cryptoQuotes} | R Documentation |
Get the long-short ratio for any available_tickers()
from the available_exchanges()
getLSRatio(
ticker,
interval = "1d",
source = "binance",
from = NULL,
to = NULL,
top = FALSE
)
ticker |
A character vector of length 1. See |
interval |
A character vector of length 1. See |
source |
A character-vector of length 1. See |
from |
An optional vector of length 1. Can be |
to |
An optional vector of length 1. Can be |
top |
A logical vector. FALSE by default. If TRUE it returns the top traders Long-Short ratios. |
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()
.
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.
An xts-object containing,
long (numeric) - the share of longs
short (numeric) - the share of shorts
ls_ratio (numeric) - the ratio of longs to shorts
See available_exchanges()
with for available exchanges.
Binance only supports data for the last 30 days. Use other exchanges if you need beyond that.
Jonas Cuzulan Hirani
Other deprecated:
availableExchanges()
,
availableIntervals()
,
availableTickers()
,
getFGIndex()
,
getQuote()
## 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;