Skip to Content
View all events

Machine Learning Algorithms for Trading Bootcamp

Published by O'Reilly Media, Inc.

Beginner to intermediate content levelBeginner to intermediate

Train machine learning algorithms to discover trading signals in 6 weeks

This live event utilizes Jupyter Notebook technology

In this course you’ll:

  • Gain access to free financial data and deployment​​ of ML algorithms that discover, transform, and visualize relationships among asset classes, sectors, and styles
  • Develop prototypes of various ML trading models that forecast the direction and magnitude of economic growth, stock price returns, and market volatility
  • Build prototypes of probabilistic trading models that quantify the uncertainty and risks of forecasts and estimates

Over 75% of the daily trading volume in US equity markets is estimated to be executed algorithmically. Algorithmic trading systems automate the rules for buying and selling financial instruments such as equities based on specific patterns or signals detected in the data. Previously, many of these trading rules were based on some combination of trader expertise or academic or in-house research. More recently, data scientists have developed machine learning (ML) models to automatically discover trading rules from patterns in the data without the need to program them explicitly. Nowadays, most algorithmic trading systems combine both expert- and ML-designed trading rules.

Join expert Deepak Kanungo to tackle the hardest part of any type of trading: discovering persistently profitable signals. You’ll develop different types of machine learning prototypes for discovering trading signals and opportunities in a research environment. References for how you can move your ML prototype models into production for live trading will be provided but are out of scope for this course. Note that the course teaches you the concepts, processes, and technologies of algorithmic trading so that you can build your own strategies. No proprietary trading algorithms or trade secrets will be taught in this course.

Week 1: Overview of Algorithmic Trading Systems

Week 2: Prototyping Linear and Nonlinear ML Trading Models

Week 3: Prototyping Probabilistic ML Models for Trading

Week 4: Prototyping Unsupervised ML Models to Discover Trading Opportunities

Week 5: Prototyping Deep Learning Neural Networks for Trading

Week 6: Prototyping Reinforcement Learning Trading Agents

Hands-on learning with interactive exercises

All exercises and labs are provided as Google Colab notebooks. There's nothing to install or configure; just click a link and get started! And you can revisit them anytime after class ends to practice and refine your skills.

NOTE: With today’s registration, you’ll be signed up for all six sessions. Although you can attend any of the sessions individually, we recommend participating in all six weeks.

What you’ll learn and how you can apply it

  • Design a customized momentum trading strategy
  • Develop an RL agent that designs a trading strategy for you
  • Build investment portfolios that reduce correlations in asset price returns
  • Apply risk management tools
  • Evaluate the performance of trading strategies
  • Apply supervised, unsupervised, and reinforcement machine learning algorithms appropriately to all aspects of the trading process
  • Understand why linear regression and classification trading models are your baseline models
  • Learn how unsupervised and deep learning algorithms can help you in engineering the features of trading models which are pivotal to their success
  • Quantify the uncertainty in the parameters of your trading models using probabilistic ML algorithms

This live event is for you because...

  • You’re an investor, trader, or financial analyst.
  • You work with traders, investors, or financial analysts.
  • You want to understand and apply ML technologies to trading.

Prerequisites

  • A new, empty Google Colab notebook
  • Basic experience with trading and investing in equities
  • Familiarity with Python and pandas DataFrames

Recommended preparation:

Recommended follow-up:

Schedule

The time frames are only estimates and may vary according to how the class is progressing.

Week 1: Overview of Algorithmic Trading Systems

Overview of investment/trading process and various trading models (60 minutes)

  • Presentation: Financial/economic model concepts including the capital asset pricing model, arbitrage pricing model, and multifactor models; technical analysis and common trading strategies, including trending and mean reverting strategies
  • Group discussion: Financial concepts and issues
  • Q&A
  • Break

Sourcing and analyzing market, fundamental, and alternative financial data (60 minutes)

  • Hands-on exercise: Import data from freely available public sources such as FRED (economic), IEX (equity), Alpha Vantage (various), Quandl (various)
  • Group discussion: Pros and cons of various data sources; issues of data extraction, cleaning, and storage
  • Hands-on exercises: Use pandas dataframes and plotting functions to analyze and visualize data
  • Q&A
  • Break

Developing and backtesting algorithmic trading strategies (60 minutes)

  • Hands-on exercises: Create a simple moving average crossover strategy; backtest the trading strategy
  • Group discussion: Analysis of the implemented algorithmic strategy; analysis of the backtest results
  • Q&A
  • Break

Evaluating risk-adjusted performance (60 minutes)

  • Presentation: Pitfalls of backtesting, especially overfitting and hindsight bias; overview of risk-adjusted performance metrics including Sharpe/information and Sortino ratios; the Kelly criterion for money management
  • Group discussion: Paramount importance of risk management and position sizing in trading; next steps, including forward testing/paper trading; issues and risks with going live with algorithmic trading
  • Q&A

Week 2: Prototyping Linear and Nonlinear ML Trading Models

Using linear models for trading (60 minutes)

  • Presentation: Training ordinary least squares linear regression model to forecast stock price returns; using lasso and ridge regression to prevent overfitting to noisy financial data; training logistic regression model to predict an economic recession; using the lasso and ridge regularization to prevent overfitting of noisy financial data; understanding how the classifier assigns probabilities
  • Hands-on exercises: Use scikit-learn module to train and test three types of linear regression models to predict stock price returns; use scikit-learn module to train and test the logistic classification models to predict an economic recession
  • Q&A
  • Break

Using DT classification and regression models to forecast market direction and returns (60 minutes)

  • Presentation: Building, training, and visualizing decision tree (DT) classification models; using prepruning and postpruning to prevent overfitting of noise in financial data; understanding how the classification metrics are used
  • Hands-on exercise: Use scikit-learn library to train and test DT classification models to predict market direction
  • Q&A
  • Break

Using RF classification and regression models to predict an economic recession and percentage loss in GDP (60 minutes)

  • Presentation: Building, training, and visualizing random forest (RF) models; using bagging and feature engineering to prevent overfitting of noisy financial data; understanding how the classifier assigns probabilities and issues with imbalanced classes
  • Hands-on exercise: Use scikit-learn library to train and test the RF classification and regression models to predict an economic recession and percentage loss in GDP
  • Q&A
  • Break

Evaluating and improving DT and RF models using GBM (60 minutes)

  • Presentation: Building, training, and testing gradient boosting models (GBM); using out-of-bag errors to measure performance; different types of boosting algorithms and learning rates to improve performance and reduce overfitting of noisy financial data
  • Hands-on exercises: Use scikit-learn to train and test GBM models and improve on the above DT and RT models
  • Q&A

Week 3: Prototyping Probabilistic ML Models for Trading

Overview of probability and epistemic inference (60 minutes)

  • Hands-on exercise: Run simulation of the Monty Hall problem
  • Presentation: Types of uncertainty and meaning of probability; inverse probability rule, the fundamental algorithm of all probabilistic programming languages
  • Q&A
  • Break

Estimating the probability of default (60 minutes)

  • Hands-on exercise: Compute the probability of credit default using the inverse probability rule in Python
  • Presentation: Overview of the PyMC3 probabilistic programming library, including the basic concepts behind MCMC, NUTS, and ADVI algorithms
  • Q&A
  • Break

Developing probabilistic linear regression models for quantifying the uncertainty of expected stock price returns (60 minutes)

  • Hands-on exercise: Compute alpha, beta, and sample error, including the 95% confidence intervals using a linear market model (MM) of a company’s stock
  • Presentation: Sources of errors in financial models and the need to quantify uncertainty in point estimates; overview of issues with confidence intervals and need for using credible intervals instead
  • Hands-on exercise: Recode the MM model in PyMC3 to produce credible intervals for all model parameters
  • Q&A
  • Break

Developing probabilistic classification models for quantifying the uncertainty of an economic recession (60 minutes)

  • Presentation: Inverse probability in odds format; simple derivation of the logit function from the inverse probability rule; how it quantifies total uncertainty
  • Hands-on exercise: Predict economic recession and quantify total uncertainty in the predicted values
  • Q&A

Week 4: Prototyping Unsupervised ML Models to Discover Trading Opportunities

Unsupervised machine learning in algorithmic trading and investing (60 minutes)

  • Presentation: Conceptual overview of unsupervised data exploration and transformation machine learning algorithms; importance of feature engineering in finance and how these algorithms help; differences in theoretical and data-driven model building in trading and investing; how algorithms improve on theoretical asset pricing models, portfolio management techniques, and investment style classifications
  • Hands-on exercises: Create pandas dataframes to concatenate data; preprocess and standardize data for unsupervised learning algorithms
  • Q&A
  • Break

Using clustering algorithms to explore equity data for pairs trading (60 minutes)

  • Presentation: Overview of pairs trading and clustering algorithms including k-means, hierarchical, and affinity propagation; enabling clustering algorithms to explore and select equities for pairs trading; visualizing clustering hierarchies using dendrograms
  • Hands-on exercise: Use scikit-learn’s clustering algorithms to select equity pairs for trading
  • Q&A
  • Break

Using principal component analysis algorithm to build data-driven asset pricing models (60 minutes)

  • Presentation: Overview of various theoretical asset pricing models; how the principal component analysis (PCA) algorithm builds data-driven factor models for asset pricing without requiring any preconceived economic theory
  • Hands-on exercises: Use scikit-learn’s PCA algorithm to build factor models for equity prices; visualize factors using heatmaps
  • Q&A
  • Break

Using PCA algorithm to increase diversification in investment portfolios (60 minutes)

  • Presentation: Overview of Markowitz’s mean variance portfolio management theory; how the PCA algorithm improves on it by reducing correlations among asset price returns
  • Hands-on exercise: Use scikit-learn’s PCA algorithm to design investment portfolios with reduced correlations among assets; derive portfolio weights with principal components
  • Q&A

Week 5: Prototyping Deep Learning Neural Networks for Trading

Deep learning models in algorithmic trading and investing (60 minutes)

  • Presentation: Conceptual overview of artificial neural network (ANN) architectures and DL models; how these algorithms help with feature engineering; differences in theoretical and data-driven model building in trading and investing; how DL algorithms improve on regression and classifications problems
  • Hands-on exercises: Set up Colab notebook; create pandas dataframes to concatenate data from freely available public sources such as FRED (economic), Yahoo (equity), and Quandl (various); preprocess and standardize data for DL algorithms
  • Q&A
  • Break

Using multilayer perceptrons to forecast economic recessions (60 minutes)

  • Presentation: Overview of multilayer perceptron networks and design choices available in Keras for building any type of ANN
  • Hands-on exercise: Use Keras to develop multilayer perceptron networks to classify economic recessions
  • Q&A
  • Break

Using convolutional neural networks to price equities (60 minutes)

  • Presentation: Overview of capital asset pricing model and convolutional neural networks (ConvNet)
  • Hands-on exercise: Use Keras to build ConvNets to price Apple stock
  • Q&A
  • Break

Using recurrent neural network to price equities (60 minutes)

  • Presentation: Overview of arbitrage pricing theory and recurrent neural networks (RNN)
  • Hands-on exercise: Use Keras to build RNNs to price Apple stock
  • Q&A

Week 6: Prototyping Reinforcement Learning Trading Agents

Understanding the reinforcement learning modeling framework (60 mins)

  • Presentation: Reinforcement learning (RL) components, modeling framework, equations, and algorithms
  • Hands-on exercise: Apply RL components to a trading agent
  • Q&A
  • Break

Applying the Markov decision process to trading (60 minutes)

  • Presentation: Overview of the Markov decision process and its properties; applying the Bellman equations to compute the optimal trading strategy
  • Hands-on exercise: Evaluate the optimal trading strategy in a simulated market environment using dynamic programming
  • Q&A
  • Break

Building a deep Q-network for approximating market environment (60 minutes)

  • Presentation: Overview of model-based and model-free RL algorithms, temporal difference learning, and Q-learning; using DL to approximate Q-values
  • Hands-on exercise: Prototype a deep Q-network to approximate Q-values using S&P 500 prices
  • Q&A
  • Break

Prototype RL-based trading strategy (60 minutes)

  • Hands-on exercises: Train and test RL-based equity-based trading agent on the deep Q-network
  • Presentation: Review and summary of RL, including its advantages and disadvantages
  • Q&A

Your Instructor

  • Deepak K. Kanungo

    Deepak K. Kanungo is an algorithmic derivatives trader, educator, and CEO and founder of Hedged Capital LLC, an AI-powered proprietary trading company. He’s also the author of the award-winning Probabilistic Machine Learning for Finance and Investing: A Primer to Generative AI with Python and teaches the O’Reilly on-demand course Hands-On Algorithmic Trading with Python. He has taught tens of thousands of traders and investors the concepts, processes, and machine learning technologies for algorithmic trading, investing, and finance with Python. Long before machine learning was an industry buzzword, Deepak invented a probabilistic machine learning method and software system for managing the risks and returns of project portfolios—a framework that has been cited by IBM, Accenture, Fujitsu, among many others. Previously, he was a financial advisor at Morgan Stanley, a Silicon Valley fintech entrepreneur, a director in the Global Planning Department at Mastercard International, and a senior analyst with Diamond Technology Partners. He was educated at Princeton University (astrophysics) and the London School of Economics (finance and information systems).

Skill covered

Machine Learning