📈

Introduction to Algorithmic Trading with Python

Apr 2, 2025

Algorithmic Trading and Python Course Notes

Instructor Introduction

  • Instructor: Nick McCollum
  • Focus: Building three quantitative finance projects.

Course Projects Overview

  1. Equal Weight S&P 500 Index Fund

    • Build an equal weight version of S&P 500 index fund.
  2. Quantitative Momentum Strategy

    • Develop a momentum strategy selecting best stocks based on momentum metrics.
  3. Quantitative Value Screener

    • Create a screener to select attractive stocks based on value metrics.

Course Housekeeping

  • Course is for educational purposes only; not investment advice.
  • Made possible by a grant from IEX Cloud.

Algorithmic Trading Basics

  • Definition: Using computers to make investment decisions.
  • Types of Algorithmic Trading:
    • High Frequency Trading (HFT)
    • Fundamental strategies using software.
  • Key Players in Algorithmic Trading:
    • Renaissance Technologies
      • AUM: $165 billion.
      • Famous for Medallion Fund.
    • AQR Capital Management
      • AUM: $61 billion.
      • Focus on applied quantitative research.
    • Citadel Securities
      • AUM: $32 billion.
      • Focus on high-frequency trading.

Using Python for Algorithmic Trading

  • Python is popular due to its libraries (e.g., NumPy).
  • Python is slower compared to other languages like C.
  • NumPy is essential for numerical computing.

Algorithmic Trading Process

  1. Collect Data
  2. Develop Hypothesis
  3. Back Test Strategy
  4. Implement Strategy

Course Configuration and API Basics

  • API: Application Programming Interface, allows interaction between software.
  • We will use IEX Cloud API for stock market data.
  • API Request Types:
    • GET: Retrieve data.
    • POST: Send data.
    • PUT: Update data.
    • DELETE: Remove data.

Equal Weight S&P 500 Fund Project

  • S&P 500 Index: Market cap weighted index of 500 largest companies in the US.
  • Goal: Build an equal weight version where all companies have the same weight.

Quantitative Momentum Strategy Project

  • Momentum Investing: Invest in assets that have increased in price the most.
  • Example: Choose stock with 35% returns over 20%.

Quantitative Value Screener Project

  • Value Investing: Invest in stocks trading below intrinsic value.
  • Common metrics:
    • Price to Earnings Ratio (P/E)
    • Price to Book Ratio (P/B)
    • Price to Free Cash Flow Ratio (P/FCF)
  • Composite of different metrics to minimize impact of specific metric flaws.

Housekeeping Items for Projects

  1. Install Dependencies: NumPy, pandas, XLSX writer.
  2. Import Libraries: Import necessary libraries and API keys.

Writing Python Code for Projects

  • Use structured approaches: Define functions, utilize loops, etc.
  • Handle exceptions and errors gracefully.

Final Thoughts

  • Each project builds on skills learned from the previous one.
  • Emphasis on real-world applications and data handling.
  • Encouragement to explore further in algorithmic trading and finance.