I've been writing code in R for only one day, but here is my first script.
Goal:
- Download list of all tickers from Yahoo for AMEX, NASDAQ, NYSE exchanges
- Sort that list by market cap, filter to only the top 100 tickers
- Retrieve historical data from Yahoo
- Store historical data into MySQL
Everything seems to work. I am posting the code below as well as attaching it.
The next step will be to make this smarter --- it doesn't need to download the entire history of the ticker every single day. Instead, it should look at the last entry in the db, then download from that point (-1 day).
It should also auto-retry on failed data downloads, right now it just reports them (this is due to Yahoo rate limiting I suspect).
I'll try to make those improvements in the next few days.
Please don't laugh at my code too much. Like I said, I have literally been working with R for about 1 day.
init.R
# Big Mike Trading
# www.bigmiketrading.com
# November 2013
# v1.0.0
# Init
rm(list=ls())
source("~/R/Daily/downloadData.R")
source("~/R/Daily/mysqlData.R")
downloadData.R
# Big Mike Trading
# www.bigmiketrading.com
# November 2013
# v1.0.0