View source: R/get_openinterest.R
| get_openinterest | R Documentation |
Get the open interest on a cryptocurrency pair from the
available_exchanges() in any actively traded available_tickers()
on the FUTURES markets.
get_openinterest(
ticker,
interval = '1d',
source = 'binance',
from = NULL,
to = NULL
)
ticker |
A character-vector of length 1.
See |
interval |
A character-vector of length 1. |
source |
A character-vector of length 1. |
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. |
Values passed to from`` or tomust 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,
index |
<POSIXct> the time-index |
open_interest |
<numeric> open perpetual contracts on both both sides |
Sample output
#> open_interest #> 2024-05-12 02:00:00 70961.07 #> 2024-05-13 02:00:00 69740.49 #> 2024-05-14 02:00:00 71110.33 #> 2024-05-15 02:00:00 67758.06 #> 2024-05-16 02:00:00 73614.70 #> 2024-05-17 02:00:00 72377.85
Serkan Korkmaz
Other get-functions:
get_fgindex(),
get_fundingrate(),
get_lsratio(),
get_quote()
## Not run:
# script start;
# 1) check available
# exchanges for open interest
cryptoQuotes::available_exchanges(
type = 'interest'
)
# 2) get BTC funding rate
# for the last 7 days
tail(
BTC <- cryptoQuotes::get_openinterest(
ticker = "BTCUSDT",
source = "binance",
from = Sys.Date() - 7
)
)
# script end;
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.