Course Description
This training course covers the basics of:
1. Finance - Stocks, equities, returns.
2. Data extraction from quandl and pandas-datareader.
2. Financial Analyses techniques using Python
3. Trading strategies - types, formulation and coding strategies in python
4. Designing and developing the backtesting framework
5. How to use Quantopian/Zipline to backtest your strategies.
6. Risk Assessment metrics
7. Design and develop your own backtesting algorithm and learn how to backtest using Quantopian.
What am I going to get from this course?
- Extract data from different sources like quandl, yahoo-finance, etc.
- Understand the principles of quantitative analysis of end of day stock pricing data.
- Build upon mathematical and statistical fundamentals.
- Formulate and develop trading strategies based on momentum indicator, moving averages, rolling window calculation and crossover techniques.
- Statistically test the strategies that you have formulated on quantopian.
- Design and develop backtesting framework.
- Understand the risk assessment metrics.
- Design and develop your own backtesting algorithm and learn how to backtest using Quantopian.
Prerequisites and Target Audience
What will students need to know or do before starting this course?
You should be familiar with:
- Python
- Pandas
- Basic Statistics and mathematics
- Interpreting graphs and plots.
Who should take this course? Who should not?
For
- You are a programmer or data analyst/scientist who familiar with basics of finance. You want to pursue a new job as a quant analyst, launch yourself in the field of fintech.
- You are someone who is fundamentally strong in programming and statistics. You wish to work as a Quant Analyst at an Investment Bank or a Hedge fund.
NOT for:
- Students who don't want to get into finance or data science.
- Students who are looking for one-stop course to learn quantitative trading to make millions.
Curriculum
Module 1: Course Overview and Exploratory Data Analysis
Lecture 1
Overview - Stocks and Trading
We discuss the strategy and guidelines to make the most of this course. We walk through over the concept of stocks and trading.
Lecture 2
Setting up the Workspace
In this video, we'll be covering the technical requirements to set up the workspace for the entire course.
We'll go through:
- Python version
- Creating a virtual environment which will have all the packages required
- Jupyter notebook
- How to write python code in Jupyter notebook
Lecture 3
Data Extraction from Quandl
Without wasting much time, let's get started with the collection of data. Getting your hands on the right dataset is very important. In this video, we're going to learn about Quandl and how can we use the Quandl API using Python to get Apple's EOD stock pricing data. We'll cover the introduction to pandas and how you can save the data to a CSV file.
Lecture 4
Exploratory Analysis on Time-series Data
Throughout the course, we'll be using data manipulation package, pandas along with NumPy, SciPy, Matplotlib, and a few others. In this lecture, we'll mainly focus on dealing with time series data, what each column in the dataframe represents and means. We'll cover slicing, subsetting and resampling techniques using pandas.
Quiz 1
Extract Microsoft Data Using your Own API Key
Here is the first assignment where you've to use the Quandl API to extract MSFT(Microsoft) EOD stock pricing data from 1st Jan, 2011 to 1st Jan, 2019.
Module 2: Performing financial analyses on stocks
Lecture 5
Calculation of Returns
The lecture would cover the common financial analyses which every quant trader should learn. We'll cover various methods of calculating returns. Here are the python functions we'll use:
- pct_change()
- resample()
- np.log - for log returns
- Plot the returns using plot() function.
Lecture 6
Cumulative Returns and Portfolio Stocks Analysis
The lecture will walk you through the importance of cumulative returns for different time windows(daily, monthly, quarterly, yearly).
We'll learn to capture data from pandas_datareader package which uses yahoo_finance.
Compare the returns of a range of stocks extracted from the pdr package.
Lecture 7
Rolling Window Statistics
In this lecture, we're going to learn about moving window statistics:
- How to calculate the rolling mean, rolling variance, rolling median, etc.
- How moving window statistics eliminates the fluctuations and spikes in the data.
- Python functions: rolling_mean(), rolling_std(), etc
Lecture 8
Volatility Calculations
In this lecture, we're going to learn about risk assessment using volatility:
- We'll calculate the variance of a stock over a period of time.
- Understanding the volatility of a stock compared with other stocks and assessing how risky is the investment.
- Formulating historical volatility on log returns.
Lecture 9
Ordinary Least-Squares (OLS) Regression Method
The lecture covers the concept of regression analysis using the statsmodel package. We are using the Ordinary Least-Squares Regression model to understand the pattern of the dependent variable(log returns of stocks) and the independent variable.
- Learn about the goodness of fit.
- Probability using F-statistics
- How to use t-tests.
- The skewness of the curve.
Quiz 2
Perform Financial Analysis on the MSFT Data
Using the data collected in the previous quiz, you have to perform a few tasks and answer the following questions.
Module 3: Formulation and development of trading strategies
Lecture 10
Introduction to Trading Strategies
The lecture covers the basics of trading strategies and common algorithms used to trade securities. In general, there are two common trading strategies: the momentum strategy and the reversion strategy. You'll learn about various types of algorithms you can develop in each of them.
Lecture 11
Steps to Formulate the Trading Strategy
A step-by-step guide to formulating the Moving average crossover algorithm.
- Translate each step into code in Jupyter notebook.
- Learn about the implementation of rolling statistics in SMA.
Lecture 12
Visualizing the Trading Signals
Learn about the matplotlib's plotting methods, we'll:
- plot the short, long moving averages
- mark the buy and sell signals in the data.
- learn about adding conditions in the plot function
Quiz 3
Let's Revise the Trading Strategies Concepts
Module 4: Developing your own backtesting framework
Lecture 13
Introduction to Backtesting
In this lecture, we'll cover:
- The basic definition and importance of backtesting.
- Pitfalls of backtesting and factors you need to take care of while designing the backtesting framework.
- Essential components of backtesting
Lecture 14
Step-by-step Guide to Developing a Backtester
We'll be moving forward to developing a simple backtester consisting of a strategy, a data handler, and a portfolio.
- We'll be following a set of instructions and translate each of them to pythonic statements using pandas dataframe.
- We'll generate the backtester which will track all our expenses, total funds, P&L, etc.
Lecture 15
Plotting the Portfolio Values
Learn about the matplotlib's plotting methods, we'll:
- plot the portfolio's total column and visualise our holdings
- introduction to quantopian
Module 5: Backtesting on Quantopian and Risk Assessment
Lecture 16
Quantopian Walk-through
In this lecture, we're going to learn about the free, community-centered platform called Quantopian:
- Advantages of backtesting on quantopian.
- How to write and backtest an algorithm on quantopian
- Learn about the backtesting results
Lecture 17
Backtesting the SMA Strategy on Quantopian
This lecture is going to cover the entire process of backtesting the strategy that we developed on quantopian. We'll see the entire dashboard of results of the backtesting. Learn about different measures on the dashboard and what they represent.
Lecture 18
Risk Assessment Metrics
After all the backtesting, you'll need to evaluate the strategy, here you'll learn about:
- Sharpe ratio
- Maximum drawdown
- Compound annual growth rate (CAGR)
You'll code these in python using statsmodel, pandas and run it over your strategy's output.
This is the last video in which we'll look at the next steps after the course, prospective projects you can take up to master the skill and links to resources and books to subscribe to. This is a defined list of resources which can help you get more clarity on quantitative trading algorithms and concepts.
Quiz 4
Test your Backtesting Skills!