Fun with Financials

When there is a need for quick and comprehensive financial data in R, quantmod comes to rescue. It was originally envisioned as a rapid prototyping environment to facilitate quantitative modeling, testing, and trading. Quantmod allows R to read data from CSV files, spreadsheets, databases, datasets of statistical packages, and from the web (Google, Yahoo, FRED, and others).

Here is a quick look on how precious metals performed in one year.

> library(quantmod)
 > getMetals(c('XPT', 'XAU','XAG'), from=Sys.Date()-365)
 > layout(matrix(1:3, nrow=3))
 > chartSeries(XPTUSD, layout=NULL, TA=NULL)
 > chartSeries(XAUUSD, layout=NULL, TA=NULL)
 > chartSeries(XAGUSD, layout=NULL, TA=NULL)
 > layout(1)

Precious Metals
Analyzing financial results and stock quotes of EMC –

 > getFinancials("EMC")
 > viewFinancials(EMC.f)

EMC Financials

 > getSymbols("EMC")
 > chartSeries(EMC)
 > addBBands()
 > reChart(subset="2014", theme="white", type="candles")
EMC Quote EMC Quote 14

Quick look at FRED (Federal Reserve Economic Data from Federal Reserve Bank of St. Louis) on Consumer Price Index –

CPI CPI Graph
This entry was posted in R and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s