Zivot's Intro to Computational Finance on Coursera Part1

matthias on 2013/01/18

I have participated in a couple of Coursera courses over the last year, or since this online education initiative began (in May 2012 or so, right?).

I really like the way these courses are structured. Now, of course, some courses I participated in where better than others, but I always felt that the quality in general was really high.

This isn’t just the case for coursera though - I really liked udacity as well.

And now I have started a class that I am particularly interested in. Firstly, because I need to refresh my probability and statistics knowledge for a project we are working on at TUM CREATE. Secondly, because it unites one of my long-term interests (stocks / trading / investment) with my background in computer science / mathematics and automatic control.

So, hopefully I can pursue this in a more systematic or even mathematically sound way from now on with Eric Zivot’s Introduction to Computational Finance.

Ok, probably I will stick to a rather conservative approach, but I should definitely gain a bit more perspective 🙂

The course looks really good, the only drawback is that it does not offer a certificate of completion (as most of the the other courses do).

I will therefore write 2 or 3 posts here to document my progress and in this way “create” my own certificate with the corresponding accountability.

Note that, even though this class presents its exercises for R or Excel, I have taken the liberty to do some of the calculations with pandas for Python where I like the syntax a lot more 🙂

I guess my R has gotten a bit rusty over the last years as well, so I guess I’ll use the class as an opportunity to polish it a bit as well 🙂

Here’s an excerpt of HW2 where I calculate portfolio returns as a vector multiplication.

import scipy as s
import datetime as dt
import pandas as pd

#Q16: Portfolio Return
x = s.array([0.8, 0.2])
retdf = pd.DataFrame(index=df_.index, columns=df_.columns)
for symb in df_.iteritems():
data = symb[1]
col = symb[0]
retdf[col][1] = (data[-1] - data[0]) / data[0]
print retdf

portret = s.dot(x, retdf.ix[dt.date(2004,10,31)])
print portret