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.
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
MySQL: Set 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!
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.
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.
Momentum and reversal are 2 well documented price trend behaviors. How do we build a trading strategy that captures these ?
Mean Reversion is another well documented effect. We'll talk about jump measures to construct a trading strategy based on 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.
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.
Let's see how trading strategies are traditionally developed using tools like Excel
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.
Install Pycharm -a Python IDE where you can develop large Python projects with several modules.
Install MySQL on Mac OS X. The MySQL server will be used to set up a price database.
We continue with MySQL installation for Mac. Configure the users on your server and install MySQL Workbench, where you will be writing queries.
The MySQL end-to-end installation (including MySQL Workbench) for 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.
We'll walk you through what's involved in setting up your own price database.
Construct a URL to download data from Yahoo Finance
The files downloaded from the NSE need to be unzipped and the contents extracted to a local path
Use the modules we've written till now to download data for 10 years
Learn how to bulk load data from csv files into MySQL tables.
Some data preparation steps, including removing duplicates and symbol changes.
Stock splits and other corporate actions affect stock prices and need to be adjusted for before we can consume the price data.
Before the data is ready to consume, we need to adjust for stock splits.
We continue with the adjusting for splits
Insert the data for the NIFTY 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)
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.
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.
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.
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.
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 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.
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.
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.
Bagging, Boosting and Stacking are different techniques to help build an ensemble that rocks!
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!
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.
An introduction to Pandas, a data manipulation library
Write a module that fetches the raw data for a ticker from your database
Write a module that will contain the functions to construct different types of features. We start with calendar features.
Write a module that will contain the functions to construct different types of features. We'll create momentum and reversal related features.
Write a module that will contain the functions to construct different types of features. We'll construct a Jump Feature
We can include some features from related tickers as inputs to the trading strategy for a ticker.
We'll engineer a categorical variable that captures a more granular trend of the past 4 weeks
Write the code to include a categorical variable in your model.
Scikit-Learn is a great Python Library that we can use to train and test Machine learning models.
See what's involved in using a random forest classifier for our Quant trading models.
Write a module that will do the train and test portions of our ML Modelling exercise.
Now that we have an end-to-end application, let's run it with different scenarios to compare the results.
We'll see how to use the Nearest Neighbors technique to develop a Quant Trading model.
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 :-)