get_quote {cryptoQuotes} | R Documentation |
Get the Open, High, Low, Close and Volume data on a cryptocurrency pair
Description
Get 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 |
source |
A character-vector of length 1. |
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. |
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. |
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,
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.1
Author(s)
Serkan Korkmaz
See Also
Other get-functions:
get_fgindex()
,
get_fundingrate()
,
get_lsratio()
,
get_openinterest()
Examples
## Not run:
# script start;
# get quote on
# BTCUSDT pair from
# Binance in 30m
# intervals from the
# last 24 hours
tail(
BTC <- cryptoQuotes::get_quote(
ticker = 'BTCUSDT',
source = 'binance',
interval = '30m',
futures = FALSE,
from = Sys.Date() - 1
)
)
# script end;
## End(Not run)