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.

We will start by setting up a Python environment and get a basic feel of the language. Then we will jump right in and use case studies to get accustomed to working with data aalysis and strategy development.

Parts 1,2 &3

The material has been restructured to a more book-like form, with its own index and is now available as a single-file download .

You can download a part of the material for free, available here . No strings attached.

Table of contents:
    Development tools
        Source code editors
        Jupyter notebook
    Overview of python basics
        Working with modules
    Visualizing data
        Visualization with matplotlib
        Plotting with Pandas
        Bokeh plots
        TWP plotting class
    Simulating leveraged etfs
        How about 3x leverage?
    Day of week seasonality of SPY
        Get the data
        Working with dates and times
        Analyse weekday seasonality
    Working with csv files
        Reading csv
        Writing csv files
    Building a stock price database
        Download historic data
        Save data to file
        Load data from file
    Performance metrics
        Sharpe ratio
        Profit ratio
    Backtesting with TWP backtesting module
        Test on real price data
        Walk-forward moving averages strategy
    Moving averages crossover strategy
        Divide dataset
        Develop strategy
        Make a parameter scan
    Permanent portfolio
        Get price data
        Simulate portfolio
    XLP strategy
        Rewrite strategy to a single function
        Make a scan of ALL parameters
    Pairs trading examples
        Get list of XLE components
        Get the price data
        Visualise dataset
        Build spread and visualise data
        Create a trading strategy
    VXX strategy
        Strategy thesis
        Get the data
        Get data from CBOE
        Research relationship VIX-VIX3M
        More precise simulation
    Leveraged ETF backtest YTD
        Create pairs
    Nearest neighbors strategy
        Strategy thesis
        Prepare data
        Create trader class
    External references

Part 4: Going live!

The final thing you need for building an automated trading system is a connection to a broker. In this part 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