
Get the Open, High, Low, Close and Volume data on a cryptocurrency pair
Source:R/get_quote.R
get_quote.RdGet a quote on a cryptocurrency pair from the available_exchanges() in
various available_intervals() for any
actively traded available_tickers().
Usage
get_quote(
ticker,
source = 'binance',
futures = TRUE,
interval = '1d',
from = NULL,
to = NULL
)Arguments
- ticker
A character-vector of length 1. See
available_tickers()for available tickers.- source
A character-vector of length 1.
binanceby default. Seeavailable_exchanges()for available exchanges.- futures
A logical-vector of length 1. TRUE by default. Returns futures market if TRUE, spot market otherwise.
- interval
A character-vector of length 1.
1dby default. Seeavailable_intervals()for available intervals.- 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.
Value
An <[xts]>-object containing,
- index
<POSIXct> The time-index
- open
<numeric> Opening price
- high
<numeric> Highest price
- low
<numeric> Lowest price
- close
<numeric> Closing price
- volume
<numeric> Trading volume
Sample output
#> open high low close volume
#> 2024-05-12 02:00:00 60809.2 61849.4 60557.3 61455.8 104043.9
#> 2024-05-13 02:00:00 61455.7 63440.0 60750.0 62912.1 261927.1
#> 2024-05-14 02:00:00 62912.2 63099.6 60950.0 61550.5 244345.3
#> 2024-05-15 02:00:00 61550.5 66440.0 61316.1 66175.4 365031.7
#> 2024-05-16 02:00:00 66175.4 66800.0 64567.0 65217.7 242455.3
#> 2024-05-17 02:00:00 65217.7 66478.5 65061.2 66218.8 66139.1Details
On time-zones and dates
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().
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.
See also
Other get-functions:
get_fgindex(),
get_fundingrate(),
get_lsratio(),
get_mktcap(),
get_openinterest()