After graduating and starting my career I found myself with something I hadn't had before: a paycheck. I went to work educating myself on how to build a financial future for myself and my then future wife. If you're at the beginning of this journey I highly recommend reading Investing from Scratch: A Handbook for the Young Investor. I've read a lot of investing and finance books, but this one is a great intro to personal finance. No matter how far down the rabbit hole of financial education I go I always find that what I'm learning was well summarized in this book for a beginner. It presents a great how-to for each stage of your financial life: paying off debt, creating an emergency savings, and then focusing on building wealth and knowing when and how to do that.

As I began investigating the Building Wealth stage I found myself asking a question every engineer finds themselves asking of everything: "How can I automate this?" When I started my career at LinkedIn I was working on our payment system writing software that handled millions of dollars in credit card payments. Could I use those skills to to automate my investments?

In trying to answer that question I've learned a lot about the field I've come to know as Computational Investing. It's a vast and fairly young field. I tend to think of it in two major pieces: High Frequency Trading (HFT), and Algorithmic Trading. Each domain tries to use computers to augment human ability. HFT leverages the speed at which computers can make decisions and Algorithmic Trading leverages the emotionless discipline necessary to save humans financial decisions from themselves.

[Photo credit: www.tradingacademy.com via flickr]

High Frequency Trading

The first thing people seem to think about with Computational Investing is High Frequency Trading (HFT). HFT became an almost household name after the 2010 Flash Crash when the the Dow Jones Industrial Average dropped 9% and recovered within minutes, an event that caused a lot of people to question the value of computers executing trades without human intervention. At it's simplest HFT is information arbitrage at the sub-second scale. Computers can ingest and process information much faster than humans. Today, computers sitting in collocated facilities within exchanges have first access to market ticker data and compete to make trading decisions in milliseconds. An entire industry has sprung up to provide sentiment analysis on news and tweets compressed into single packets optimized to make it through a congested network. Companies now spend millions of dollars to shave a millisecond off of trading decision times only to become obsolete in months.

Jacob Loveless has a great write-up on the HFT tech stack in an article in the Communications of The ACM titled Barbarians at the Gateways. In it he gives the following anecdote:

"I remember coming home late one night, and my mother, a math teacher, asked why I was so depressed and exhausted. I said, 'Imagine every day you have to figure out a small part of the world. You develop fantastic machines, which can measure everything, and you deploy them to track an object falling. You analyze a million occurrences of this falling event, and along with some of the greatest minds you know, you discover gravity. It's perfect: you can model it, define it, measure it, and predict it. You test it with your colleagues and say, 'I will drop this apple from my hand, and it will hit the ground in 3.2 seconds,' and it does. Then two weeks later, you go to a large conference. You drop the apple in front of the crowd...and it floats up and flies out the window. Gravity is no longer true; it was, but it isn't now. That's HFT. As soon as you discover it, you have only a few weeks to capitalize on it; then you have to start all over.'"

As a geek HFT is incredibly interesting with fun technical challenges. It doesn't, however, help a nerd automate his investing.

Algorithmic Trading

While HFT augments humans speed limitations, Algorithmic Trading augments humans tendency to respond to the market emotionally. HFT operates at the sub-second scale while Algorithmic Trading operates on the daily, weekly, or monthly time frame and could be as simple as a Python script that builds a Value Based Portfolio (or any trading philosophy) without human intervention. People have always had their magic excel spreadsheets that have performed similar functions, but robust platforms for consumer investors are just now starting to become mainstream.

For example, if you're a passive investor and want to effortlessly build a portfolio of ETFs companies like Betterment and Wealthfront have a team of robots who will do that for you. They'll even do daily tax loss harvesting in some cases. Everything you would want to do if you were automating your own investing, without the headache of maintenance or writing buggy software. Plus there is no commission on trades executed for re-balancing or loss harvesting. Your account behaves like a single instrument although it is not taxed that way.

If you're interested in retaining control of a traditional brokerage account, but want to augment your analysis plenty of tools exist beyond your custom spreadsheet. I've met a community of entrepreneurs building tools that do just that while reading up on and tweeting about this subject. I recently met David Pinsen on Twitter and even had the opportunity to grab a beer with him the last time I was in New York. Besides being a fun conversationalist, he's built Portfolio Armor, a tool for hedging any market position based on your risk tolerance. Or take Riskalyze for example. It's a company that builds tools for financial advisers and it's website summarize the space well by stating, "Despite all of our advances in technology, the world still invests the vast majority of its financial assets using a combination of gut instincts, hunches, [and] emotionally-driven decisions."

This is a huge space. I've cherry picked a few examples of products that I'm casually familiar with, but it's clear that people are becoming more comfortable with having algorithms augment their decision making. With products like Portfolio Armor the impact is a direct relationship between investor and algorithm while with Riskalyze there are still people investing and advising, but their decisions are informed by non-trivial algorithmic analysis.

If you want to get your hands really dirty, it is possible to write an algorithm and either paper trade (get trade recommendations) or tie your code directly to a brokerage account and execute trades directly. Quantopian, a Boston Based startup, is a product that does exactly this allowing you to share and build communities around your trading algorithms or keep them proprietary and profit. They provide a Python based API for looking up current and historical data, testing your algorithm on historical data (back-testing), and letting it run live. I haven't had the opportunity to play with the platform too much, but hope to have the chance soon.

What Excites Me

As an nerd, HFT is the most fun to learn about. I've included a handful of links below if you'd like to dive deeper. I really enjoyed Tucker Balch's course on Computational Investing on Coursera and highly recommend it. If you write code regularly and have a vague idea of how the stock market works you should be fine keeping pace casually on the side. He does a great job of introducing investment metrics and algorithmic trading techniques. I really enjoyed the lecture on the end-to-end consumer trading stack from the customers E*Trade account, to the brokerage systems, through the market makers and directly into the NYSE. By the end of the class you've written a Python based portfolio optimizer. The focus isn't exclusively HFT, but it sets a good foundation. I also definitely recommend reading Barbarians at the Gateway. Loveless gives a great in-depth overview of the HFT stack and his experiences as he's watched the field mature.

As a consumer, I love the promises of companies like Wealthfront. It appeals to my techie side with its human-less well researched algorithms. I also tend to agree with the passive investment philosophy the company embraces. If you haven't already, I highly recommend checking it out. I've been a customer for a little while now and couldn't be happier. If you decide to sign up, consider using my referral code. ;)

As a hacker, I love the tools that companies like Quantopian provide. I like the idea of learning and playing with the market by back-testing trading ideas. I don't know that I'll ever tie it directly to a brokerage account, but I haven't completely discounted the idea. It would really be a matter of how expensive and what minimum requirements are set by their brokerage partners. However, I can definitely see setting aside a small amount of money and manually executing trades suggested by their paper trading solution. It would definitely be fun, and with luck possibly profitable.

Quantopian also hosts meet ups about algorithmic trading. I haven't attended one myself, but they have an upcoming event this month (March 2014) in San Francisco that you can find more information about at http://www.meetup.com/Bay-Area-Algorithmic-Trading/.

Resources