Course 1 - Machine Learning for Trading
Brief Overview
This was a brief introduction to Machine Learning for Trading.
- Introduction to Pandas and Numpy Libraries
- Generated stock indicators for recognizing potential buy and sell signals.
- Introduced Machine Learning and Reinforcement Learning concepts for real-world applications.
Detailed Overview
Project Overview
Projects were designed to build on one another to finish with a trading bot able to beat a buy-and-hold strategy. Below is an overview of how the projects tied together.

Project 1: Martingale Roulette Simulation
Focused on implementing a Martingale betting strategy where a player doubles their bet after a loss and places a one-dollar bet after a win. Two scenarios are considered: unlimited funds and fixed cash.
Difficulty: 2/5 (Refresher)
Summary: Good introduction to using Python (especially for me who doesn't use it regularly).
Project 2: Optimize Something
Calculated cumulative returns, average daily returns, standard deviation of daily returns, and Sharpe Ratio. Then used an optimizer to allocate stock percentages to maximize Sharpe Ratio.
Difficulty: 2/5
Summary: More hands-on with Numpy, Pandas, and optimization using scipy.
Project 3: Assess Learner
Implemented three types of decision trees (Decision Trees, Random Trees, Bag Learners) and compared their effectiveness through metrics like RMSE, leaf node count, and R².
Difficulty: 5/5
Summary: Building a decision tree from scratch (without classes or nodes) was very challenging but helped me understand its strengths and weaknesses.
Project 4: Defeat Learners
Created datasets that performed well for one learner (linear regression or decision tree) while performing poorly on the other.
Hint: Generate decision-tree-friendly datasets for trees; generate linear relationships for linear regression.
Difficulty: 1/5
Summary: Quick project (~1-2 hours) with some math skills, made faster since no report was required.
Project 5: MarketSim
Built a market simulator based on a CSV file of stock orders. Calculated portfolio values and reported metrics.
Difficulty: 3/5
Summary: Would be difficult standalone, but was made easier thanks to Professor Tucker's lectures walking through the steps.
Project 6: Indicator Evaluation
Researched and manually built stock indicators using Numpy and Pandas. Indicators were crucial for the final trading bot project.
Difficulty: 4/5
Summary: Learned a lot about stock indicators and improved my personal trading strategies, especially for options trading.
Project 7: Q Learning Robot
Developed a Q-Learner robot to find optimal paths to a reward. Although not directly tied to stock trading, I later used Q-Learning for my trading bot strategy.
Difficulty: 3/5
Summary: Great project to understand dynamic programming and reinforcement learning concepts better.
Project 8: Strategy Evaluation
This project combined skills from previous projects:
- Used the market simulator to evaluate strategies.
- Applied researched indicators from Project 6.
- Built a trading bot using either a Q-Learner or a Decision Tree.
Difficulty: 5/5
Summary: I chose the Q-Learner for its adaptiveness, even though Decision Trees were easier to implement and often performed better for most students.