Quandl provides a large number of datasets with financial information, most of it of time series type like currencies, stocks and macroeconomic figures. In this page you will find a mini tutorial to access this information through your R console in order to run, for instance, regression algorithms for predictive purposes. A first step will be to get a token pass from Quandl web site. To do so, you will have to sign up for a Quandl account, after that, run this code to store your token pass for future use. > Qtoken <- 'xxxxxxxxxxxxx' > save(list="Qtoken", file="Quandl_token") From now on, every time you start your R console, you just have to load the token file and start using Quandl datasets. > load("Quandl_token") Let's search for IT companies stocks > library("Quandl") > Quandl.search('IT stocks', page = 1, source = NULL, silent = FALSE, authcode = Quandl.auth(Qtoken)) The answer to the previous search will be info related to three most relevant main datasets Gartner ( IT ) - Stock Price Code: OFDP/DMDRN_IT_STOCK_PX Desc: Units: dollars. Corporate Finance data is collected and calculated by Prof. Aswath Damodaran, Professor of Finance at the Stern School of Business, New York University. The raw data is available here: http://pages.stern.nyu.edu/~adamodar/New_Home_Page/data.html Freq: annual Cols: Date|Stock Price IT stocks (open) Code: USER_1KR/1KT Desc: This superset has no description. Freq: daily Cols: Date|AAPL|GOOG|MSFT|IBM|T Gartner ( IT ) - Return on Equity Code: OFDP/DMDRN_IT_ROE Desc: Estimated by dividing the net income by the book value of equity. If book value of equity is negative, this is not estimated. Units: %. Corporate Finance data is collected and calculated by Prof. Aswath Damodaran, Professor of Finance at the Stern School of Business, New York University. The raw data is available here: http://pages.stern.nyu.edu/~adamodar/New_Home_Page/data.html Freq: annual Cols: Date|Return on Equity Say, for instance that we are interested in the second one, giving stock info of Apple, Google, Microsoft, IBM and AT&T. Let's ask for monthly data from January 2013. > stockdata = Quandl("USER_1KR/1KT", collapse="monthly", start_date="2013-01-01", type="ts") > stockdata AAPL GOOG MSFT IBM T Jan 2013 456.98 750.51 27.79 203.32 34.53 Feb 2013 444.05 801.10 27.88 202.18 35.80 Mar 2013 449.82 803.99 28.32 209.83 36.69 Apr 2013 435.10 819.00 32.56 199.13 37.37 May 2013 452.50 868.12 34.82 208.59 35.33 Jun 2013 431.56 888.65 34.97 203.02 35.83 ¸.·´¯`·.´¯`·.¸¸.·´¯`·.¸><(((º> Interesting work of Quandl Team. Congrats ! |
Data Mining with R >