EZ Study

Actuarial Biology Chemistry Economics Calculators Confucius Engineer
Physics
C.S.

Financial Data Visualization in R

Many readers are likely familiar with the finance sites on Yahoo and Google as sources for tracking stock, mutual fund, and exchange traded fund (ETF) prices and returns. Using quantmod, one can easily load this data into R by specifying the the same ticker symbol that is used in these two web sources.

Quantmod is a specific module in R for Wall Street Stock market trading data, designed to assist the quantitative trader in the development, testing, and deployment of statistically based trading models. As with any other R package, one must install the quantmod package in the usual way.

You can run this module, you need to install first:
install.packages('quantmod')

Then you can call the corresponding module:
library("quantmod")     
require(xts)                

getSymbols("RAD",from="2013-10-01")    # scr="yahoo" is the default
getSymbols("RAD",src="google",from="2013-10-01") 
chartSeries(RAD) 
# use the white background, instead of the black, by default. 
chartSeries(RAD,theme='white')
chartSeries(RAD,theme='white',multi.col=TRUE)

chartSeries(RAD,theme='white',multi.col=TRUE)


Some highly-recommended data visulization books
       
image For more details, click the download the following pdf tutorial: R quantmod Tutorial, R XTS Tutorial, R TTR Tutorial

Another powerful tool to get IntraData, that is, the minutes block of trading data is this tool called "QuantShare", here is for more step-by-step tutorial how to get Intradata.

Symbol Meaning Example
%d day as a number (0-31) 01-31
%a
%A
abbreviated weekday
unabbreviated weekday
Mon
Monday
%m month (00-12) 00-12
%b
%B
abbreviated month
unabbreviated month
Jan
January
%y
%Y
2-digit year
4-digit year
07
2007


# convert date info in format 'mm/dd/yyyy'
# The default format is yyyy-mm-dd
strDates <- c("01/05/1965", "08/16/1975")
dates <- as.Date(strDates, "%m/%d/%Y")

Some highly-recommended data visulization books
       

Thanks to the helpful input from statmethods.net and www.cyclismo.org.

Some highly-recommended R Tutorial books
         

Related links:
Continue to Formatting SQL query, Tips to use Group Statement   SAS Interview

Back to Logistic regression with multiple predictors   Analytics Home