Computational Investing part I on Coursera

I recently finished up my second course on Coursera – Computational Investing I by Tucker Balch.  Learned a little bit more about how the stock market works, and (maybe somewhat) how the quants do their thing.  A little bit of what they do could probably be called order book exploitation — looking for arbitrage opportunities between buy and sell orders at the microsecond level.  This type of computational investing is pretty much out of reach for anyone outside of a big firm with direct trading floor access.

What’s left for the little guy is offline, day-to-day analysis of stock information.  Dr. Balch has created a Python package, QSTK, which pulls downloaded stock price information into a data analysis friendly format within Python.  I really liked how the assignments all fit together — I now have a basic, yet functional, “Market Sim” in Python.  It is not really a predictive simulation for future market movement; rather it is an evaluation tool for how a certain metric-based investment strategy would have performed if executed during a past window of time.  For instance, the final assignment involved setting up an “event study” looking for instances where a Bollinger band metric behaved in a fashion showing that the stock was falling while the overall market was rising.  Whenever the event was observed for a given stock, the tool logs a buy order for the stock followed by a sell order 20 days later.  Then, a separate piece of code reads in the buy/sell orders and computes what the overall rate of return (and other metrics like Sharpe ratio) would be given actual stock price historical data, then compares the strategy to the overall performance of the market during the same time period.  Thus the Market Sim developed in this course would allow the user to try out different investment strategies, evaluating them against real historical data.

It’s a simple yet pretty cool project that I’m glad to have completed.  Especially glad for the opportunity to get back into Python, which I still love (two timing now with Matlab, I guess…) and which I’ve got a pretty decent workflow going with PyScripter (nice tool).

But I don’t think I’ll be going into business anytime soon as a day trader.  My first inclination was to somehow meld the Market Sim developed in this course with a neural network or other machine learning strategy — then you wouldn’t need to explicitly define any “events.”  But a quick Google search shows that many have tried this and failed.  Maybe it is due to my second reservation, which is that past performance is not a reliable indication of future performance.  (But it’s the best we have to go with, so maybe that’s ok…)  Third reservation is that many strategies would involve too many individual trades to be profitable for the little guy, both when trade commissions and when the time required to execute trades manually are taken into account.  (Are there any systems where you can specify auto-trades upon a certain event?  That would be cool, but scary too … if the perfect storm comes and your algorithm gets really fouled up, it could clear out your bank account real fast.  Automated gambling, anyone?)

Not saying it is impossible for the little guy to be profitable using these methods, but it would be difficult.  The course itself talks about the fundamental law, basically saying that if you aren’t able to execute a small number sure-fire big money trades, then your only recourse is to execute a very large number of more modest trades, each with a slim yet positive probabilistic chance of profitability.  But lots and lots of trades are impractical for the little guy for reasons discussed above.  Also, I tend to believe in the efficient market hypothesis, simply because there are so many people working on this problem, with so much more knowledge and resources than I have to devote to it.  I think I’ll stick with index investing.

On a side note, shortly before taking this course I read an article on the Aladdin system used by Blackrock.  (I can’t find the article now … it wasn’t this Economist piece, nor was it this one from FT.)  A lot of money is controlled by algorithms now, for better or for worse.  I couldn’t help thinking of the Asimov story from I, Robot, where artificial intelligences are directly controlling the economy . . . are we there yet?

Advertisements

One response

  1. Heard recently about the book “A Random Walk Down Wall Street” (good overview here: http://www.thesimpledollar.com/review-a-random-walk-down-wall-street ) and looks like a pretty strong proponent of the efficient market hypothesis; eg. “technical analysis” of the sort that was explored in this course (predicting future stock prices based on past results) is kind of specious.

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: