Machine Learning for Trading

Michael Chen
Attenchen to Detail
4 min readJan 14, 2020

This past semester I took Machine Learning for Trading for the Georgia Tech Online Masters CS program. It was one of the better courses offered by the program. Since I finished, I wanted to summarize my learnings of computational finance, AKA technical analysis, AKA financial engineering, yadda yadda.

Before I begin, I would like to frame my summary as “ways to create value”. I like this perspective because it tells me what I can do with my newfound knowledge.

tl;dr how can I create value and make money in the field of computational finance?

1. Create clean, useful trades data (easier)

The first portion of the course jogged my memory on how to manipulate financial data using python. I found python3 to be very useful, especially in combination with numpy and pandas. What I took away from this part of the course was that getting clean, useful trades data is a challenge.

For my second assignment, I had to optimize the portfolio allocations given a set of stocks such that the portfolio Sharpe ratio was maximized. This assignment required me to comb through Yahoo! finance data that had missing data. I was taught to forward-fill, so as to not “peek into the future”. One thing this assignment didn’t have me do was to adjust the data for survivor bias. At the end of the day, I learned that having clean unbiased data was valuable and various companies can make money just off selling this data (eg. Quandl).

2. Create a simulator for a real stock exchange (ok)

The second portion of the course taught me investing from a computing perspective. It showed me how exchanges operate, how orders arrive and are executed, and what buy, sell, market, and limit orders are. I learned about “high frequency trading” through a special 60 minutes clip (not actually 60 minutes long). I even watched The Big Short (great hilarious movie) as part of our curriculum.

Then I had to build a market simulator as one of our programming assignments. The simulator accepted trading orders, kept track of a portfolio’s value over time, and assessed the performance of that portfolio. Through this assignment and lecture videos, I came to realize operating an exchange is very lucrative (think of just the exchange fees!) and also rife with problems like flash crashes and front-running. I realized there is value in creating an exchange and also value for creating a trades simulator on top of various exchanges. An investment banker could use the simulator to backtest trading strategies.

3. Create useful technical indicators and strategies for trading (harder)

Ah the juicy part. I labeled this as the harder thing to do because in practice to make money, I would be competing against other people. I’d create ML algorithms for trading and if I do well, the thing of value I create is straight cash. Of course, if I didn’t do well…

Anyway, leading up to this part of the course, I had to read What Hedge Funds Really Do. The book is coauthored by the course professor so it’s a bit of self promotion. It’s very light reading but did cover a lot, from CAPM to Renaissance Technologies. I would recommend as a refresher for folks who have taken finance classes before or as a primer for beginners.

The bulk of the programming assignments in the last third of the semester taught me the ins and outs of employing technical analysis and machine learning in order to create a smart(?) trading robot.

For one of the assignments, I learned what technical indicators are and used a few traditional ones such as SMA, bollinger bands, and even MACD to create a manual trading strategy. I leave it to the reader to learn what these indicators are but basically I created a manual trading algorithm that would buy or sell based on if any of these indicators passed a certain threshold.

In a following assignment, I used various techniques such as decision trees and boosting to program up an ML driven algorithm for trading. I used the indicators from the prior assignment as features and framed it as a supervised learning problem. I even had the opportunity to explore framing this as a reinforcement learning problem but unfortunately didn’t have enough time to implement that as a solution instead of my boosted decision tree algorithm.

And there you have it! Three ways a hustler like you can make money in the field of computational finance.

…alternatively you can roll the dice and buy out of the money TSLA calls like my roommate… and then have TSLA shoot up to $500+

*eyeroll*

I promise I’m not bitter :)

Thanks for reading and happy trading~

--

--

Michael Chen
Attenchen to Detail

ML@ROBLOX — Trying to make some sense in a hectic world