Monday, April 29, 2013

Poor Boy's Data

Before we start collecting data we have to remember that a model is only as good as the data it uses but quality data comes with an expensive price tag and we don't have the cash to spare. For our purposes Yahoo! Finance will have to suffice.


Code


Language: Python 2.7
3rd Party Packages: None

This program is pretty simple to use, all we have to do is run the program and wait for it to terminate. Our data comes from Yahoo! so depending on the internet connection and the amount of data being downloaded this may take a few minutes to complete.

FileSnack link:  http://snk.to/f-c7clb99t

The zipped file contains:
  1. Main program: poorBoysData.py 
  2. S&P 500 companies: SP500.txt
  3. Empty folder: Tickers
To ensure the program runs properly keep the contents in the same location.  If we're saving to the desktop poorBoysData.py, SP500.txt, and Tickers all need to be on the desktop; if we're saving to the documents folder then poorBoysData.py, SP500.txt, and Tickers all need to be saved to the documents folder.


How the Code Works


Our Yahoo! Data Collector is pretty straight forward.  Our program navigates to Yahoo, downloads the historical data, and saves it to the file [stock's ticker].txt in the folder 'Tickers.'

In our back test we always ran into problems with 4:1 stock splits and special one-time dividends so to correct these data errors we replaced Yahoo!'s open, high, low, and close with the following:
Open = (Open / Close) * Adjusted Close
High= (High/ Close) * Adjusted Close
Low= (Low/ Close) * Adjusted Close
Close = Adjusted Close
The price adjustment can be turned off by setting adjustPrices to False.


Further Functionality and Modification


There are four primary variables that if changed will make the program perform a different function and collect data in a different way. We can choose to collect data from the S&P500 by changing isSP500 to True or we can collect a specific set of data by setting isUsersTickers to True and populating the usersTickerList list with ticker symbols.  The fourth is the adjustPrices variable mentioned above. 

Wednesday, April 24, 2013

Purpose of theBrokeQuant


If you’re anything like me you’re looking to trade while maintaining a day job, a life, and a budget.  This puts us at a severe disadvantage as we’re not always around a computer to check our positions and most unfortunately we can’t afford those fancy programs, super high-speed connections, or thoroughly scrubbed, extremely accurate data that helps us do so.  We must improvise with what we have: the Internet, a computer, and programming knowledge. 

Throughout this blog I will publish tools, code, and analyses that will help us better understand and track the market without drastically altering our wallets or our already busy schedules.