Skip to content

Instantly share code, notes, and snippets.

@neerajt
Forked from micahstubbs/get_financial_data.r
Last active August 29, 2015 14:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neerajt/192ad539e459f82a332a to your computer and use it in GitHub Desktop.
Save neerajt/192ad539e459f82a332a to your computer and use it in GitHub Desktop.
require(Quandl)
symbolList <- c("AMZN","GOOG", "MSFT", "AAPL", "GLW", "HAL")
data <- data.frame("Date" = c(),
"Effective Tax Rate" = c(),
"Earnings Before Interest and Taxes" = c(),
"symbol" = c())
for(symbol in symbolList){
effectiveTaxRate = Quandl(paste0("DMDRN/", symbol, "_EFF_TAX"), trim_start="2003-01-01", trim_end="2014-12-31")
EBIT = Quandl(paste0("DMDRN/", symbol, "_EBIT"), trim_start="2003-01-01", trim_end="2014-12-31")
tmp_data <- merge(effectiveTaxRate,EBIT,by=c("Date"))
tmp_data$symbol <- symbol
data <- rbind(data, tmp_data)
bp <- barplot(tail(table(data$symbol), 50), xaxt="n")
labs <- names(table(data$symbol))
text(x=bp, y=-1.25, labels=labs, xpd=TRUE, srt=315)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment