Description Usage Arguments Details Value Functions Note See Also Examples
Function family to retrieve specific info for a given ticker.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | getStockInfo(ticker, clean.mcap = TRUE, clean.sector = TRUE,
auto.assign = FALSE, env = .GlobalEnv)
getStockInfo.name(ticker)
getStockInfo.sector(ticker, clean.sector = TRUE)
getStockInfo.exchange(ticker)
getStockInfo.last(ticker)
getStockInfo.industry(ticker)
getStockInfo.IPO.year(ticker)
getStockInfo.market.cap(ticker, clean.mcap = TRUE)
|
ticker |
Character; the ticker for the stock you need info about |
clean.mcap |
Logical; should the Market.Cap element be returned cleaned. If |
clean.sector |
Logical; should the Sector element be returned cleaned. Sector cleaning is done using
|
auto.assign |
Logical; should the results be assigned to |
env |
Environment; where to auto.assign objects. Setting |
Based off of the TTR
function stockSymbols
it compensates for different data types and difficulty
in accessing specific ticker data. Data retrieval depends on the TTR
package, which retrieves its data
from NASDAQ
Returns a list containing the elements:
Name |
Character; name of the company |
Last.Trade |
Numeric; price of the last trade for the company |
Sector |
Character; sector of the company |
Industry |
Character; descriptive industry name |
IPO.Year |
Integer; year of the company's IPO |
Exchange |
Character; exchange that the company currently trades on. One of: |
Market.Cap |
Numeric (or Character); current market capitalization for the company |
getStockInfo.name
: Loads the company name for the given ticker (if available)
getStockInfo.sector
: Loads the sector for the given ticker, allows changing the clean.sector
variable
getStockInfo.exchange
: Loads the exchange for the given ticker (if available)
getStockInfo.last
: Loads the last trade price for the given ticker
getStockInfo.industry
: Loads the last descriptive industry name for the given ticker
getStockInfo.IPO.year
: Loads the IPO year for the given ticker (if available)
getStockInfo.market.cap
: Loads the current market capitalization for the given ticker (if available), allows changing the clean.mcap
variable
Values for Sector
may not be identical to sectors listed in getSectorWeights
.
Values for Sector
, IPO.Year
, and Market.Cap
are occasionally missing and will default to
NA. getStockInfo
caches the data for stockSymbols
in a hidden global variable (.ss
)
to massively increase speed on subsequent uses of the function.
Other data retrieval functions: getHoldings.SMIF
,
getSectorETF
, getSymbols.SMIF
1 2 3 4 5 6 7 8 | getStockInfo("NVDA")
getStockInfo.name("NVDA")
getStockInfo.sector("NVDA")
getStockInfo.exchange("NVDA")
getStockInfo.last("NVDA")
getStockInfo.industry("NVDA")
getStockInfo.IPO.year("NVDA")
getStockInfo.market.cap("NVDA", clean.mcap=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.