O'Reilly logo
live online training icon Live Online training

Quantitative trading with Python

enter image description here

Build a momentum trading strategy to predict stock prices

Harshit Tyagi

Join expert Harshit Tyagi to learn the basics of quantitative analysis, from data processing to trading signal generation with stocks. In this practical, hands-on training course, you'll use Python to work with historical stock data and develop trading strategies based on the momentum indicator. You'll then discover how to perform a statistical test on the mean of the returns to conclude if there is alpha in the signal.

Whether you want to pursue a new job in finance, get started on the path to a quant trading career, or master the latest AI applications in quantitative finance, this course offers you the opportunity to master valuable data and AI skills that will get you there.

What you'll learn-and how you can apply it

By the end of this live online course, you’ll understand:

  • How to backtest a trading strategy
  • Market mechanics
  • How to generate signals with stocks

And you’ll be able to:

  • Build a trading strategy based on momentum and momentum crashes
  • Implement and test your strategy in Python
  • Statistically test the strategies you've built

This training course is for you because...

  • You're a programmer or data scientist with a background in fintech who wants to pursue a job in finance or launch yourself on the path to becoming a quant trader.
  • You're a data analyst (or you have strong fundamentals in programming and statistics), and you want to work as a quant analyst at an investment bank or a hedge fund.


  • A working knowledge of Python, pandas, and Matplotlib
  • A basic understanding of statistics, linear algebra, and calculus
  • Familiarity with momentum trading

Recommended preparation:

About your instructor

  • Harshit Tyagi is a Full Stack Developer and Data Engineer at Elucidata, a Cambridge based Biotech company. He develops algorithms for research scientists at the world’s best medical schools like Yale, UCLA, and MIT. Before Elucidata, he was working as a Systems Development Engineer at an Investment Management firm called Tradelogic where he designed a framework to analyze financial news from all prominent sources to produce accurate trading signals. He is a Python evangelist and loves to contribute to tech communities like Google Developers Groups, Python Delhi User Groups, and other E-learning platforms. With the skills acquired over years and being a mentor and reviewer for more than 3 years in the E-learning era, it’d be great to share the enterprise-grade practices to produce more skillful data scientists and quantitative traders.


The timeframes are only estimates and may vary according to how the class is progressing

Introduction to quantitative trading (50 minutes)

  • Lecture: Quantitative trading overview; how to access data of any stock or instrument from Oanda
  • Group discussion: What is momentum trading? What are log returns? Why should you use Python for trading? How do you get the data for algorithm trading?
  • Hands-on exercise: Read and plot data; correct the format of data extracted
  • Q&A
  • Break (10 minutes)

Building your strategy on the data collected (50 minutes)

  • Lecture: Statistical time series analysis; calculating log returns; using NumPy to calculate log returns and add them to the data frame; building your strategy over those intervals
  • Group discussion: Types of log returns, different ways of calculating log returns, deciding intervals/periods over which the log returns are to be calculated
  • Hands-on exercise: Plot the strategies and return
  • Q&A
  • Break (10 minutes)

Backtest the strategy (50 minutes)

  • Lecture: The statistical theory behind backtesting strategies; the significance of p-value, t-tests, and the Sharpe ratio
  • Group discussion: What is p-value? What is hypothetical testing? What is the Sharpe ratio?
  • Hands-on exercise: Backtest your strategy in IPython
  • Wrap-up and Q&A (10 minutes)

Take-home exercise:

  • Working with historical data of a given stock universe, generate a trading signal based on a momentum indicator. Then compute the signal, produce projected returns, and perform a statistical test to conclude if there is alpha in the signal.