I've added two pages specifically to help new users to get started.
Tools: here you'll find all the info you need to set up a development environment.
Cookbook: Overview of recipies I've written. The code itself is hosted on Google Code.
Monday, October 17, 2011
Saturday, October 15, 2011
How to download a bunch of csv files
I'll be analyzing VIX futures data, so to start with, I need all the files from CBOE. They use a consistent format for file names, which is easy to generate. The following script creates a data directory and then downloads all csv files for the period 2004-2011. As you can see, not much coding is required, less than 30 lines!
from urllib import urlretrieve import os m_codes = ['F','G','H','J','K','M','N','Q','U','V','X','Z'] #month codes of the futures dataDir = os.getenv("USERPROFILE")+'\\twpData\\vixFutures' # data directory def saveVixFutureData(year,month, path): ''' Get future from CBOE and save to file ''' fName = "CFE_{0}{1}_VX.csv".format(m_codes[month],str(year)[-2:]) urlStr = "http://cfe.cboe.com/Publish/ScheduledTask/MktData/datahouse/{0}".format(fName) try: urlretrieve(urlStr,path+'\\'+fName) except Exception as e: print e if __name__ == '__main__': if not os.path.exists(dataDir): os.makedirs(dataDir) for year in range(2004,2012): for month in range(12): print 'Getting data for {0}/{1}'.format(year,month) saveVixFutureData(year,month,dataDir) print 'Data was saved to {0}'.format(dataDir)
Friday, October 14, 2011
Sunday, September 25, 2011
Getting Started
First of all, I must admit that it took me quite some time even to consider switching from Matlab to Python. I've been working with Matlab for more than ten years, and I must say that it is an excellent tool for research. However, both in my professional and private work there where quite some cases where Matlab was not the best tool to do the job. This forced me to learn things like Labwindows and C# for gui programming, php for website building. Not to forget that Matlab is not a free (not as in speech, nor as in beer) product.
Still, the main reason for me trying to make the switch, is Python being a 'swiss knife of programming'. It can be used to make excellent GUIs with Qt, conduct research with SciPy, program dynamic websites and so on.
All posts on this blog will be based on the following tooling:
Still, the main reason for me trying to make the switch, is Python being a 'swiss knife of programming'. It can be used to make excellent GUIs with Qt, conduct research with SciPy, program dynamic websites and so on.
All posts on this blog will be based on the following tooling:
Subscribe to:
Posts (Atom)