Machine Learning for Trading
The course introduces students to the real world challenges of implementing machine learning based trading strategies including the algorithmic steps from information gathering to market orders. The focus is on how to apply probabilistic machine learning approaches to trading decisions. We consider statistical approaches like linear regression, Q-Learning, KNN and regression trees and how to apply them to actual stock trading situations.
It was divided into five main projects: assessing a portfolio, instance / ensemble learners, market simulators, trading learners, and reinforcement learning.
Course CS6601 Machine Learning for Trading
Date December 2014
Skills Python, Pandas, linear regression, Q-Learning, KNN and regression trees
Role Individual assignments
A portfolio is a collection of stocks (or other assets) and corresponding allocations of funds to each of them. In order to evaluate and compare different portfolios, we first need to compute certain metrics, based on available historical data.
The primary goal of this assignment is to introduce you to this form of portfolio analysis. We used pandas for reading in data, calculating various statistics and plotting a comparison graph.
In the course, we created a market simulator that accepted trading orders and kept track of a portfolio’s value over time and then finally assessed the performance of that portfolio.
Simple Market Strategy
A basic Bollinger Band trading strategy works as follows: There are two potential entries, long and short. The long entry is made when the price transitions from below the lower band to above the lower band. This indicates that the stock price has moved substantially away from the moving average, but is now moving back towards the moving average. When this entry signal criteria is met, buy the stock and hold it until the exit. The exit signal occurs when the price moves from below the SMA to above it.
The short entry and exit are mirrors of the long entry and exit: The short entry is made when the price transitions from above the upper band to below the upper band. This indicates that the stock price has moved substantially away from the moving average, but is now moving back towards the moving average. When this entry signal criteria is met, short the stock and hold it until the exit. The exit signal occurs when the price moves from above the SMA to below it.
In this course, we implemented the Q-Learning and Dyna-Q solutions to the reinforcement learning problem. We applied them to two problems: 1) Navigation, and 2) Trading. The reason for working with the navigation problem first is that navigation is an easy problem to work with and understand. In the last part of the assignment we applied Q-Learning to stock trading.