The course focuses as much as possible on hands-on examples of real problems involved in quantitative trading. We will start with setting up developing environment and getting historic price data. After that we will backtest a couple of typical trading strategies. A final part of the course focuses on automated trading through Interactive Brokers API. Theoretical part (math & computer science) will be kept to a minimum and only treated where needed.
Before taking the course you will set up your own Python environment and get a basic feel of the language. This part of the course is freely available. We will jump right in and use two case studies to get accustomed to working with scientific tooling.
- Why Python
- Setting up Python environment
- Python basics
- Writing, running and debugging code.
- Introduction to Numpy
- Plotting with matplotlib
- Monte-carlo simulation of leveraged etfs.
Before we start with the fun part of strategy development we need to collect and sort price data. This week is about getting the data from various sources. To spice it up with a test case, we will download the entire S&P500 universe daily prices from yahoo finance.
- Introduction to Pandas
- Working with times and dates.
- Reading and writing CSV files
- Reading excel files
- Reading HDF5 files
- Getting data from the web (Yahoo finance, CBOE, etc)
- Seasonality of SPY: is there an edge based on day of the week?
- Get entire S&P500 universe history and save it to a database.
This is the fun part, which is only limited by your own creativity. We will go through several strategy test cases.
- Calculating pnl and performance metrics : sharpe en drawdown
- Simple momentum strategy using moving averages
- Permanent portfolio strategy
- XLP strategy
- Pairs trading strategy (building a neutral spread and backtesting it)
- Volatility strategies
- Leveraged ETFs strategy
The final thing you need for building an automated trading system is a connection to a broker. This week we will focus on using Interactive Brokers API for receiving real-time data and submitting orders.
- Connecting to Interactive Brokers with ibpy
- Downloading historic intraday data
- Getting real time stock data
- Placing orders