Ticker-class | R Documentation |
Base class for getting all data related to ticker from Yahoo Finance API.
An R6 class object
symbol
Symbol for which data is retrieved.
valuation_measures
Retrieves valuation measures for most recent four quarters
option_chain
Option chain data for all expiration dates for a given symbol
option_expiration_dates
Option expiration dates
option_strikes
Option strikes
quote
Get real-time quote information for given symbol
recommendations
Recommended symbols
technical_insights
Technical indicators for given symbol
new()
Create a new Ticker object.
Ticker$new(symbol = NA)
symbol
Symbol.
A new 'Ticker' object
aapl <- Ticker$new('aapl')
set_symbol()
Set a new symbol.
Ticker$set_symbol(symbol)
symbol
New symbol
aapl <- Ticker$new('aapl') aapl$set_symbol('msft')
get_history()
Retrieves historical pricing data.
Ticker$get_history(period = "ytd", interval = "1d", start = NULL, end = NULL)
period
Length of time. Defaults to 'ytd'
. Valid values are:
'1d'
'5d'
'1mo'
'3mo'
'6mo'
'1y'
'2y'
'5y'
'10y'
'ytd'
'max'
interval
Time between data points. Defaults to '1d'
. Valid values are:
'1m'
'2m'
'5m'
'15m'
'30m'
'60m'
'90m'
'1h'
'1d'
'5d'
'1wk'
'1mo'
'3mo'
start
Specific starting date. String
or date
object in yyyy-mm-dd
format.
end
Specific ending date. String
or date
object in yyyy-mm-dd
format.
A data.frame
.
\donttest{ aapl <- Ticker$new('aapl') aapl$get_history(start = '2022-07-01', interval = '1d') aapl$get_history(start = '2022-07-01', end = '2022-07-14', interval = '1d') aapl$get_history(period = '1mo', interval = '1d') }
clone()
The objects of this class are cloneable with this method.
Ticker$clone(deep = FALSE)
deep
Whether to make a deep clone.
## ------------------------------------------------
## Method `Ticker$new`
## ------------------------------------------------
aapl <- Ticker$new('aapl')
## ------------------------------------------------
## Method `Ticker$set_symbol`
## ------------------------------------------------
aapl <- Ticker$new('aapl')
aapl$set_symbol('msft')
## ------------------------------------------------
## Method `Ticker$get_history`
## ------------------------------------------------
aapl <- Ticker$new('aapl')
aapl$get_history(start = '2022-07-01', interval = '1d')
aapl$get_history(start = '2022-07-01', end = '2022-07-14', interval = '1d')
aapl$get_history(period = '1mo', interval = '1d')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.