RATA Lecture Notes Download Financial Statements
RATA Lecture Notes Download Financial Statements
What? Example
Financial statements are available for securities The following example will download the most re-
through several web sites including Yahoo! Finance, cent (2018 or 2017) annual income statements for all
Google and Nasdaq. These include, balance sheet, S&P-500 companies.
income statement and cash flow statement. Nas-
net install http://researchata.com/stata/010/fetchcomponents.pkg, force
daq.com, however, provides these financial state- fetchcomponents, symbol(^GSPC)
levelsof Symbol, local(symbols) clean
ments in a structured format which makes the down- foreach aa in `symbols' {
di "`aa'"
load process easy, fast and relatively reliable. These clear
capture: fetch_statements `aa', freq(a) st(IS)
financial statement are available for the current pe- if (_rc==0) {
if (_N>5) {
riod as well as for the past few periods (usually four qui: ds
local temp = word("`r(varlist)'",2)
quarters or four years). rename `temp' most_recent
keep item most_recent
Method gen symbol="`aa'"
capture: append using SP500_IS.dta
save SP500_IS.dta, replace
While we can download financial data to many of }
}
the spreadsheet software, we will be using Stata. }