Skip to content
GetProfitable
Search

Intro to Algorithmic Trading with Python

Turn a trading idea into tested, honest Python. Load and clean OHLCV data, build indicators from scratch, write vectorized and event-driven backtests with real costs, evaluate with Sharpe, drawdown and Monte Carlo, avoid overfitting, and go live carefully with paper trading and kill switches.

Module 1: Setup

Install Python the boring way, isolate every project in a venv, and lay out a repo you can reproduce a year from now.

  1. Python and virtual environments10 min
  2. Jupyter, pandas, numpy and matplotlib12 min
  3. Project layout and reproducibility12 min

Take the module quiz

Module 2: Getting data

Load free CSVs, understand what yfinance does and does not give you, survey broker APIs, and store clean bars as parquet in UTC.

  1. CSV from free sources and the yfinance caveats12 min
  2. Broker APIs: Alpaca, IBKR and Binance11 min
  3. Parquet storage and timezones12 min

Take the module quiz

Module 3: Working with OHLCV in pandas

Resample bars, compute simple and log returns, and build SMA, EMA, RSI and ATR from scratch so you know exactly what they measure.

  1. Resampling and returns12 min
  2. Rolling windows, SMA and EMA12 min
  3. RSI and ATR from scratch13 min

Take the module quiz

Module 4: Your first strategy as code

Write a moving-average crossover as rules, turn signals into positions and positions into returns, and plot an equity curve.

  1. A moving-average crossover as rules11 min
  2. Signal, position, returns12 min
  3. A vectorized backtest and the equity curve12 min

Take the module quiz

Module 5: Realism

Charge yourself commissions and slippage, execute on the next bar, kill look-ahead with shift(), and size positions from ATR.

  1. Costs and slippage12 min
  2. Next-bar execution and avoiding look-ahead13 min
  3. Position sizing by ATR13 min

Take the module quiz

Module 6: Evaluation

CAGR, Sharpe and max drawdown; trade-level stats recovered from a vectorized backtest; and a Monte Carlo bootstrap of what else could have happened.

  1. CAGR, Sharpe and max drawdown12 min
  2. Trade-level stats from a vectorized backtest12 min
  3. Monte Carlo bootstrap13 min

Take the module quiz

Module 7: Event-driven backtesting

Why vectorized code cannot model stops and limits honestly, a minimal event loop class, and order types including brackets.

  1. Why vectorized breaks for stops and limits11 min
  2. A minimal event loop14 min
  3. Order types and bracket orders14 min

Take the module quiz

Module 8: Parameter search and overfitting

Grid search, why the best cell is a lie, walk-forward analysis, the purged cross-validation idea, and how to report results you would believe from a stranger.

  1. Grid search and the overfitting trap13 min
  2. Walk-forward analysis13 min
  3. Purged cross-validation and honest reporting13 min

Take the module quiz

Module 9: Going live carefully

A broker adapter pattern for paper trading, scheduling and logging, alerts, kill switches, idempotent orders, state persistence and monitoring.

  1. Paper trading and the broker adapter13 min
  2. Scheduling, logging and alerts12 min
  3. Kill switches, idempotent orders and state14 min

Take the module quiz

Module 10: Project

Build a complete mean-reversion system end to end, review it against a checklist, and decide what to study next.

  1. Build the system end to end16 min
  2. Code review checklist12 min
  3. Next steps9 min

Take the module quiz

Educational content, not financial advice.