Quant Trading using Machine Learning
3.9 (201 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
2,969 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Quant Trading using Machine Learning to your Wishlist.

Add to Wishlist

Quant Trading using Machine Learning

A completely practical approach to applying Machine Learning techniques to Quant Trading
3.9 (201 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
2,969 students enrolled
Created by Loony Corn
Last updated 7/2017
Curiosity Sale
Current price: $10 Original price: $50 Discount: 80% off
30-Day Money-Back Guarantee
  • 11 hours on-demand video
  • 2 Articles
  • 60 Supplemental Resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Develop Quant Trading models using advanced Machine Learning techniques
  • Compare and evaluate strategies using Sharpe Ratios
  • Use techniques like Random Forests and K-Nearest Neighbors to develop Quant Trading models
  • Use Gradient Boosted trees and tune them for high performance
  • Use techniques like Feature engineering, parameter tuning and avoiding overfitting
  • Build an end-to-end application from data collection and preparation to model selection
View Curriculum
  • Working knowledge of Python is necessary if you want to run the source code that is provided.

A Note on Python: The code-alongs in this class all use Python 2.7. Source code (with copious amounts of comments) is attached as a resource with all the code-alongs.

Prerequisites: Working knowledge of Python is necessary if you want to run the source code that is provided. Basic knowledge of machine learning, especially ML classification techniques, would be helpful but it's not mandatory.

Taught by a Stanford-educated, ex-Googler and an IIT, IIM - educated ex-Flipkart lead analyst. This team has decades of practical experience in quant trading, analytics and e-commerce. 

This course takes a completely practical approach to applying Machine Learning techniques to Quant Trading

Let’s parse that.

Completely Practical: This course has just enough theory to get you started with both Quant Trading and Machine Learning. The focus is on practically applying ML techniques to develop sophisticated Quant Trading models. From setting up your own historical price database in MySQL to writing hundreds of lines of Python code, the focus is on doing from the get go.

Machine Learning Techniques: We'll cover a variety of machine learning techniques, from K-Nearest Neighbors and Decision Trees to pretty advanced techniques like Random Forests and Gradient Boosted Classifiers. But, in practice Machine Learning is not just about the algorithms. Feature Engineering, Parameter Tuning, Avoiding overfitting; these are all a part and parcel of developing Machine Learning applications and we do it all in this course. 

Quant Trading: Quant Trading is a perfect example of an area where the use of Machine Learning leads to a step change in the quality of the models used. Traditional models often depend on Excel and building sophisticated models requires a huge amount of manual effort and domain knowledge. Machine Learning libraries available today allow you to build highly sophisticated models that give you much better performance with much less effort. 

What's Covered: 

Quant Trading : Financial Markets, Stocks, Indices, Futures, Return, Risk, Sharpe Ratio, Momentum Investing, Mean Reversion, Developing trading strategies using Excel, Backtesting

Machine Learning: Decision Trees, Ensemble Learning, Random Forests, Gradient Boosted Classifiers, Nearest Neighbors, Feature engineering, Overfitting, Parameter Tuning

MySQLSet up a historical price database in MySQL using Python. 

Python Libraries : Pandas, Scikit-Learn, XGBoost, Hyperopt

Using discussion forums

Please use the discussion forums on this course to engage with other students and to help each other out. Unfortunately, much as we would like to, it is not possible for us at Loonycorn to respond to individual questions from students:-(

We're super small and self-funded with only 2 people developing technical video content. Our mission is to make high-quality courses available at super low prices.

The only way to keep our prices this low is to *NOT offer additional technical support over email or in-person*. The truth is, direct support is hugely expensive and just does not scale.

We understand that this is not ideal and that a lot of students might benefit from this additional support. Hiring resources for additional support would make our offering much more expensive, thus defeating our original purpose.

It is a hard trade-off.

Thank you for your patience and understanding!

Who is the target audience?
  • Yep! Quant traders who have not used Machine learning techniques before to develop trading strategies
  • Yep! Analytics professionals, modelers, big data professionals who want to get hands-on experience with Machine Learning
  • Yep! Anyone who is interested in Machine Learning and wants to learn through a practical, project-based approach
Students Who Viewed This Course Also Viewed
Curriculum For This Course
67 Lectures
You, This Course and Us
1 Lecture 02:00

We start off with an introduction to the course. We'll talk about what's included in the course and what you as a student can take away at the end of it. 

The class will begin assuming some basic knowledge of Financial markets. If you would like a primer on these topics, please skip to the end of the class. 

Preview 02:00
Developing Trading Strategies in Excel
7 Lectures 01:10:36

Traders need to understand how markets behave. This understanding can lead to the development of models that capture the market behaviour.

The class will begin assuming some basic knowledge of Financial markets. If you would like a primer on these topics, please skip to the last section of the class. 

Preview 10:27

Momentum and reversal are 2 well documented price trend behaviors. How do we build a trading strategy that captures these ?

Momentum Investing

Mean Reversion is another well documented effect. We'll talk about jump measures to construct a trading strategy based on mean reversion.

Mean Reversion

How do you know if your trading strategy is any good? Risk and Return are 2 important measures that are used to compare trading strategies.

Evaluating Trading Strategies - Risk And Return

Risk and Return by themselves are important measures to compare trading strategies. The Sharpe Ratio is a measure that accounts for Risk and Return both, and is very popular in the evaluation of trading strategies.

Evaluating Trading Strategies - The Sharpe Ratio

Let's see how trading strategies are traditionally developed using tools like Excel

Developing a Trading Strategy in Excel
Setting up your Development Environment
6 Lectures 52:26

Install the Anaconda Python distribution on your machine. We also show you the iPython Notebook interface that you can use for developing Python projects and how to install modules with pip.

Installing Anaconda for Python

Install Pycharm -a Python IDE where you can develop large Python projects with several modules.

Installing Pycharm - a Python IDE

Install MySQL on Mac OS X. The MySQL server will be used to set up a price database.

MySQL Introduced and Installed (Mac OS X)

We continue with MySQL installation for Mac. Configure the users on your server and install MySQL Workbench, where you will be writing queries.

MySQL Server Configuration and MySQL Workbench (Mac OS X)

The MySQL end-to-end installation (including MySQL Workbench) for Windows.

MySQL Installation (Windows)

If you are unfamiliar with softwares that require working with a shell/command line environment, this video will be helpful for you. It explains how to update the PATH environment variable, which is needed to set up most Linux/Mac shell based softwares. 

[For Linux/Mac OS Shell Newbies] Path and other Environment Variables
Setting up a Price Database
17 Lectures 02:22:57

We'll walk you through what's involved in setting up your own price database.

Preview 06:23

Manually download data for 10 years

Construct a URL to download data from Yahoo Finance

CodeAlong - Dowloading Price data from Yahoo Finance

CodeAlong - Downloading a URL in Python

CodeAlong - Downloading Price data from the NSE

Manually download data for 10 years

The files downloaded from the NSE need to be unzipped and the contents extracted to a local path

CodeAlong - Unzip and process the downloaded files

Use the modules we've written till now to download data for 10 years

CodeAlong - Download Historical Data for 10 years

Inserting the Downloaded files into a Database

Learn how to bulk load data from csv files into MySQL tables.

CodeAlong - Bulk loading downloaded files into MySQL tables

Some data preparation steps, including removing duplicates and symbol changes.

Data Preparation

CodeAlong - Data Preparation

Stock splits and other corporate actions affect stock prices and need to be adjusted for before we can consume the price data.

Adjusting for Corporate Actions

Before the data is ready to consume, we need to adjust for stock splits.

CodeAlong - Adjusting for Corporate Actions 1

We continue with the adjusting for splits

CodeAlong - Adjusting for Corporate Actions 2

Insert the data for the NIFTY into MySQL

CodeAlong - Inserting Index prices into MySQL

Construct a table which holds calendar features for a market that trades on a given set of days. Use this as a template to create tables for Indian market , NYSE (using NIFTY, S&P)

CodeAlong - Constructing a Calendar Features table in MySQL
Decision Trees, Ensemble Learning and Random Forests
11 Lectures 02:45:27

What are Decision Trees and how are they useful? Decision Trees are a visual and intuitive way of predicting what the outcome will be given some inputs. They assign an order of importance to the input variables that helps you see clearly what really influences your outcome.

Preview 17:00

Recursive Partitioning is the most common strategy for growing Decision Trees from a training set.

Learn what makes one attribute be higher up in a Decision Tree compared to others.

Growing the Tree - Decision Tree Learning

We'll take a small detour into Information Theory to understand the concept of Information Gain. This concept forms the basis of how popular Decision Tree Learning algorithms work.

Branching out - Information Gain

ID3, C4.5, CART and CHAID are commonly used Decision Tree Learning algorithms. Learn what makes them different from each other. Pruning is a mechanism to avoid one of the risks inherent with Decision Trees ie overfitting.

Decision Tree Algorithms

Overfitting is one of the biggest problems with Machine Learning - it's a trap that's easy to fall into and important to be aware of.

Overfitting - The Bane of Machine Learning

Overfitting is a difficult problem to solve - there is no way to avoid it completely, by correcting for it, we fall into the opposite error of underfitting.

Overfitting Continued

Cross Validation is a popular way to choose between models. There are a few different variants - K-Fold Cross validation is the most well known.

Cross Validation

Overfitting occurs when the model becomes too complex. Regularization helps maintain the balance between accuracy and complexity of the model.


The crowd is indeed wiser than the individual - at least with ensemble learning. The Netflix competition showed that ensemble learning helps achieve tremendous improvements in accuracy - many learners perform better than just 1.

The Wisdom Of Crowds - Ensemble Learning

Bagging, Boosting and Stacking are different techniques to help build an ensemble that rocks!

Ensemble Learning continued - Bagging, Boosting and Stacking

Decision trees are cool but painstaking to build - because they really tend to overfit. Random Forests to the rescue! Use an ensemble of decision trees - all the benefits of decision trees, few of the pains!

Random Forests - Much more than trees
A Trading Strategy as Machine Learning Classification
1 Lecture 15:51

Let's see how Machine Learning fits into the Quant Trading context. We define the problem statement and understand which class of problems it falls into.

Preview 15:51
Feature Engineering
8 Lectures 01:20:10

An introduction to Pandas, a data manipulation library

Know the basics - A Pandas tutorial

Write a module that fetches the raw data for a ticker from your database

CodeAlong - Fetching Data from MySQL

Write a module that will contain the functions to construct different types of features. We start with calendar features.

CodeAlong - Constructing some simple features

Write a module that will contain the functions to construct different types of features. We'll create momentum and reversal related features.

CodeAlong - Constructing a Momentum Feature

Write a module that will contain the functions to construct different types of features. We'll construct a Jump Feature

CodeAlong - Constructing a Jump Features

CodeAlong - Assigning Labels

CodeAlong - Putting it all together

We can include some features from related tickers as inputs to the trading strategy for a ticker.

CodeAlong - Include support features from other tickers
Engineering a Complex Feature - A Categorical Variable with Past Trends
2 Lectures 10:35

We'll engineer a categorical variable that captures a more granular trend of the past 4 weeks

Engineering a Categorical Variable

Write the code to include a categorical variable in your model.

CodeAlong - Engineering a Categorical Variable
Building a Machine Learning Classifier in Python
5 Lectures 36:54

Scikit-Learn is a great Python Library that we can use to train and test Machine learning models.

Preview 03:33

See what's involved in using a random forest classifier for our Quant trading models.

Introducing RandomForestClassifier

Write a module that will do the train and test portions of our ML Modelling exercise.

Training and Testing a Machine Learning Classifier

Now that we have an end-to-end application, let's run it with different scenarios to compare the results.

Compare Results from different Strategies

Using Class probabilities for predictions
Nearest Neighbors Classifier
2 Lectures 11:05

We'll see how to use the Nearest Neighbors technique to develop a Quant Trading model.

A Nearest Neighbors Classifier

CodeAlong - A nearest neighbors Classifier
2 More Sections
About the Instructor
Loony Corn
4.3 Average rating
5,034 Reviews
39,160 Students
77 Courses
An ex-Google, Stanford and Flipkart team

Loonycorn is us, Janani Ravi and Vitthal Srinivasan. Between us, we have studied at Stanford, been admitted to IIM Ahmedabad and have spent years  working in tech, in the Bay Area, New York, Singapore and Bangalore.

Janani: 7 years at Google (New York, Singapore); Studied at Stanford; also worked at Flipkart and Microsoft

Vitthal: Also Google (Singapore) and studied at Stanford; Flipkart, Credit Suisse and INSEAD too

We think we might have hit upon a neat way of teaching complicated tech courses in a funny, practical, engaging way, which is why we are so excited to be here on Udemy!

We hope you will try our offerings, and think you'll like them :-)