All Modules¶
Every Learn-Quant lesson, grouped by track. Each card links to the full write-up with runnable code and worked examples.
Python Fundamentals¶
Core Python for financial analysis — start here if you are new to code.
-
Python Basics - Comprehensions
BeginnerPython
Comprehensions are Python's most elegant way to transform data—replacing loops with readable, performant one-liners. This module teaches list, dict, set comprehensions, generator expressions, and functional tools (
map,filter,reduce,accumulate) used constantly in quantitative finance for data cleaning, signal generation, and portfolio calculations. -
BeginnerPython
Control flow structures (
if/elif/else,for,while, comprehensions,break,continue) are the foundation of all algorithms. This module teaches how to make decisions, iterate through data, and build the logic patterns used in trading systems, backtests, and risk management tools. -
Python Basics - Dates and Times
BeginnerPython
Markets run on a calendar, not a clock. Interest accrues over days, options
-
Python Basics - Essential Libraries
BeginnerPython
A working quant leans on a small set of libraries for almost everything. A few of
-
BeginnerPython
This utility teaches Python functions - the building blocks of modular, reusable code. Learn to write efficient trading algorithms and financial tools using proper function design.
-
Python Basics - Imports and Modules
BeginnerPython
Almost every Python program begins with a few import lines. An import is how you
-
BeginnerPython
Covers the NumPy primitives that appear in virtually every quant codebase — from vectorised return calculations to portfolio variance via the quadratic form. All examples use realistic financial data so the connection between the NumPy API and actual quant work is immediate.
-
BeginnerPython
After completing this lesson, you'll understand:
-
BeginnerPython
Covers the Pandas patterns that power real quant research pipelines — from building a synthetic OHLCV DataFrame through rolling indicators, resampling, groupby analysis, and a simple SMA-crossover backtest. Every example is grounded in price data so the link from Pandas API to practical quant work stays concrete.
-
BeginnerPython
This beginner-friendly utility introduces Python string fundamentals through hands-on examples. It is perfect for newcomers following the learning path in
Documentation/Programs/level1_fundamentals.pyand looking for extra practice manipulating text data.
Data Structures¶
The right container for the job: arrays, lists, dicts, sets on market data.
-
BeginnerPython
Welcome to the comprehensive guide to NumPy arrays! This utility is designed to help both beginners and experienced Python programmers master array operations for data analysis, scientific computing, and quantitative finance.
-
Data Structures - Dictionaries
BeginnerPython
This utility provides comprehensive Python dictionary operations essential for financial data organization, lookup tables, and key-value mappings. Dictionaries are the backbone of feature engineering and data lookup in quantitative finance.
-
BeginnerPython
Lists are Python's most fundamental data structure—ordered, mutable collections used for storing time series data, portfolio holdings, transaction logs, and any sequence of values. Master list operations and you unlock efficient data processing essential for trading systems and quantitative analysis.
-
Data Structures - Tuples and Sets
BeginnerPython
Tuples and Sets are fundamental Python data structures that complement Lists and Dictionaries. Understanding when to use them is key to writing efficient, Pythonic code for financial applications.
Algorithms¶
Classic computer-science algorithms applied to price and order data.
-
IntermediatePython
Backtracking is a general algorithmic technique for solving problems by building candidates incrementally and abandoning a candidate ("backtracking") as soon as it is determined to violate the problem constraints. It is a systematic form of exhaustive search that prunes the search space to avoid exploring clearly invalid paths.
-
Algorithms - Dynamic Programming
IntermediatePython
Dynamic Programming (DP) is an algorithmic technique for solving problems by breaking them into overlapping subproblems, solving each subproblem once, and storing the result to avoid redundant computation. It converts exponential-time recursive solutions into polynomial-time ones.
-
IntermediatePython
Graph algorithms operate on structures composed of vertices (nodes) and edges (connections). Many financial problems are naturally modelled as graphs: currency markets form weighted directed graphs, asset correlation matrices define undirected weighted graphs, and order routing networks are flow graphs.
-
IntermediatePython
This module implements fundamental machine learning algorithms from scratch using only NumPy — no scikit-learn or frameworks. Building these algorithms by hand is the most effective way to understand what happens inside the black boxes used in production trading systems.
-
IntermediatePython
Searching algorithms find a target value within a data structure. The choice of algorithm determines whether a search takes O(n) time (checking every element) or O(log n) time (dividing the search space in half each step). In latency-sensitive financial systems, this difference is meaningful at scale.
-
IntermediatePython
A comprehensive implementation of fundamental sorting algorithms with detailed explanations, complexity analysis, and performance comparisons.
-
IntermediatePython
String algorithms handle efficient manipulation, searching, and analysis of text data. In quantitative finance, string processing is essential for parsing market data feeds, extracting information from news and filings, matching ticker symbols, and cleaning raw data from APIs.
-
IntermediatePython
Tree data structures organise data hierarchically to enable efficient search, insertion, and deletion. Binary Search Trees (BSTs) and their balanced variants (AVL trees, Red-Black trees) are the foundation of many performance-critical systems in finance, including order book matching engines, index structures for time-series databases, and priority queues for event-driven simulations.
Advanced Python¶
Production engineering: async, OOP, concurrency, resilient error handling.
-
IntermediatePython
In quantitative finance, speed is edge. Python's
asynciolibrary allows for concurrency, letting your program handle multiple tasks (like fetching data from 10 different exchanges) at once, rather than waiting for one to finish before starting the next. -
Advanced Python - Context Managers
IntermediatePython
Context Managers are a powerful Python feature for resource management. They allow you to allocate and release resources precisely when you want to. The most common usage is the
withstatement. -
Advanced Python - Decorators and Generators
IntermediatePython
Decorators and Generators are powerful Python features that separate professional code from beginner scripts. Decorators allow you to modify function behavior cleanly, while Generators enable memory-efficient processing of large financial datasets.
-
Advanced Python - Error Handling
IntermediatePython
Robust error handling is what separates a script that crashes overnight from a professional trading system that runs for years. This module teaches you how to anticipate, catch, and manage errors gracefully.
-
Advanced Python - Multiprocessing
IntermediatePython
Python Global Interpreter Lock prevents multiple threads from executing Python bytecode at the same time. This makes threads useless for intense algorithmic work. The multiprocessing module bypasses the lock entirely by spawning separate operating system processes. Each process has its own Python interpreter and memory space, enabling true parallelism across all processing cores.
-
IntermediatePython
Object-Oriented Programming (OOP) is essential for building scalable, maintainable trading systems and financial applications. Learn to organize code using classes, objects, and OOP principles.
Quantitative Methods¶
The mathematics underpinning modern finance, implemented from first principles.
-
Quantitative Methods - Bayesian Inference
AdvancedPython
A strategy wins 7 of its first 10 trades. Is its true win rate 70%? Almost
-
Quantitative Methods - Bootstrap
AdvancedPython
The bootstrap estimates the sampling distribution of any statistic by resampling the observed data with replacement — no normality assumption required. It is the honest way to put confidence intervals around backtest metrics like Sharpe ratio, mean return, or maximum drawdown.
-
Quantitative Methods - Cointegration
AdvancedPython
Cointegration: two non-stationary series whose linear combination is stationary. Backbone of statistical arbitrage and pairs trading.
-
Quantitative Methods - Copulas
AdvancedPython
This module demonstrates the concept of Copulas, specifically the Gaussian Copula, used in quantitative finance to model the dependency structure between multivariate random variables.
-
Quantitative Methods - Extreme Value Theory
AdvancedPython
Most risk models assume returns are normally distributed. They are not —
-
Quantitative Methods - Factor Models
AdvancedPython
Factor models explain asset returns as a linear combination of systematic factors plus a stock-specific residual. The Fama-French 3-Factor Model (1992) extended CAPM by adding two well-documented risk premia: the Size premium (SMB) and the Value premium (HML), dramatically improving the explanation of cross-sectional stock returns.
-
AdvancedPython
GARCH (Generalized Autoregressive Conditional Heteroskedasticity) captures volatility clustering — high-volatility days tend to follow high-volatility days. Used for risk forecasting, option pricing, and VaR.
-
Quantitative Methods - Hypothesis Testing
AdvancedPython
You found an edge. The average daily return of your strategy is positive, one
-
Quantitative Methods - Interest Rate Models
AdvancedPython
Continuous-time models for the evolution of the short (instantaneous) interest rate. Used for bond pricing, interest rate derivatives, and yield curve modeling.
-
Quantitative Methods - Kalman Filter
AdvancedPython
This module provides a pure Python implementation of a 1-Dimensional Kalman Filter. Kalman filters are recursive algorithms used to estimate the state of a linear dynamic system from a series of noisy measurements.
-
Quantitative Methods - Linear Algebra
AdvancedPython
Linear algebra is the mathematical foundation for portfolio optimization, risk modeling, factor analysis, and quantitative finance. This utility teaches essential concepts through practical financial applications.
-
Quantitative Methods - Markov Chains
AdvancedPython
A Markov chain models a system that hops between a finite set of states
-
Quantitative Methods - Numerical Methods
AdvancedPython
Most of the formulas in finance cannot be solved with algebra. There is no
-
Quantitative Methods - Optimization
AdvancedPython
Optimization is the mathematical engine behind modern finance. From finding the best portfolio weights to calibrating complex models, optimization techniques are essential for quantitative analysts.
-
Quantitative Methods - Performance Analysis
AdvancedPython
This module provides quantitative performance metrics to evaluate risk-adjusted returns and the quality of investment strategies. Beyond simple metrics like the Sharpe Ratio, these tools help quants analyze tail risk, active management skill, and the statistical properties of return series.
-
Quantitative Methods - Principal Component Analysis
AdvancedPython
PCA finds the orthogonal directions that explain the most variance in a dataset. In finance it powers yield-curve decomposition (level/slope/curvature), statistical factor extraction, dimensionality reduction, and covariance de-noising.
-
Quantitative Methods - Regime Detection
AdvancedPython
Identifies distinct market states (bull/bear, low/high volatility) using statistical methods. Regime-aware strategies adapt parameters to the current market environment.
-
Quantitative Methods - Regression Analysis
AdvancedPython
Regression analysis is the statistical "Swiss Army Knife" of quantitative finance. It allows you to quantify relationships between variables, such as how a stock moves relative to the market (Beta) or how factors drive returns.
-
Quantitative Methods - Statistics
AdvancedPython
This utility provides comprehensive statistical analysis tools essential for quantitative finance, risk management, and investment analysis. Statistics forms the foundation for understanding financial data patterns, risk assessment, and predictive modeling.
-
Quantitative Methods - Stochastic Processes
AdvancedPython
Stochastic processes are mathematical models for random systems evolving over time. In finance, they are used to model asset prices, interest rates, and volatility for pricing derivatives and managing risk.
-
AdvancedPython
This utility provides comprehensive Time Value of Money (TVM) calculations essential for financial analysis, investment evaluation, and capital budgeting. TVM is the foundation of quantitative finance and corporate finance.
-
Quantitative Methods - Time Series
AdvancedPython
This utility introduces core time-series techniques used in quantitative finance. It serves as a bridge between the intermediate and advanced curriculum (
Documentation/Programs/level3_financial.pyandlevel4_advanced.py) and gives you reusable helpers for analyzing historical price data.
Options, Derivatives & Finance¶
Pricing, Greeks, fixed income and valuation of financial instruments.
-
IntermediatePython
This module covers advanced mathematical techniques for pricing financial derivatives. The focus is on models beyond the standard assumptions. Rather than assuming constant volatility, we explore dynamic and local volatility models. These models are crucial for correctly valuing exotic options and managing the risks of complex derivatives portfolios.
-
IntermediatePython
This module lets you price basic stock options (calls and puts) using the Black-Scholes formula, a foundation of modern financial analysis.
-
IntermediatePython
This utility lets you calculate the fair price of a bond or estimate its yield to maturity (YTM), two of the most basic (and important!) ideas in investing.
-
IntermediatePython
CAPM is the idea that won a Nobel Prize and still anchors how the industry
-
IntermediatePython
This tool calculates the present value of a series of future cash flows—the basic principle behind valuing businesses, real estate, projects, and stocks!
-
IntermediatePython
This utility does NOT use any external APIs. All data is managed locally for learning and experimentation.
-
IntermediatePython
Beta measures how much a stock or portfolio moves compared to the overall market.
-
Finance - Correlation Analysis
IntermediatePython
Analyze correlations between financial instruments for portfolio construction and risk management.
-
Finance - Covariance Estimation
IntermediatePython
Sample covariance is noisy and often poorly conditioned with many assets. Shrinkage estimators blend sample covariance with a structured target for more stable portfolio optimization.
-
IntermediatePython
The Merton (1974) structural credit model treats a firm's equity as a call option on its assets. Default occurs when asset value falls below debt face value at maturity.
-
IntermediatePython
Fixed income sensitivity measures that quantify how bond prices respond to changes in interest rates.
-
IntermediatePython
Monte Carlo pricing for path-dependent options that have no simple closed-form solution (or where the path matters, not just the terminal price).
-
IntermediatePython
Expected Shortfall (ES), also called Conditional Value at Risk (CVaR), measures the expected loss given that losses exceed the VaR threshold. It is a coherent risk measure — unlike VaR, it captures tail severity, not just frequency.
-
IntermediatePython
Core analytics for foreign exchange markets: no-arbitrage pricing, option valuation, and cross-rate calculations.
-
IntermediatePython
The Options Greeks measure the sensitivity of an option's price to changes in underlying market parameters. They are the primary tools used by options traders and risk managers to understand, hedge, and monitor options positions.
-
Finance - Implied Volatility Surface
IntermediatePython
Black-Scholes turns volatility into a price. The market runs the formula
-
IntermediatePython
The Kelly Criterion determines the optimal fraction of capital to allocate to maximize the long-run geometric growth rate of wealth.
-
IntermediatePython
Options strategies combine multiple option legs (calls and puts at different strikes and expiries) to create specific risk/reward profiles. Rather than taking a directional bet with a single option, multi-leg strategies allow traders to express nuanced views on direction, volatility, time decay, and risk limits.
-
IntermediatePython
Position sizing is the most underrated skill in quantitative trading. A strategy with a mediocre edge and excellent position sizing will outperform a brilliant strategy with reckless sizing. This module covers four fundamental frameworks every trader and quant must understand before risking real capital.
-
Finance - Transaction Cost Analysis
IntermediatePython
Tools for measuring execution quality and estimating market impact. TCA is essential for evaluating whether a strategy's theoretical alpha survives real-world trading costs.
-
Finance - Volatility Calculator
IntermediatePython
Calculate various volatility metrics for financial instruments.
-
IntermediatePython
The yield curve is the most closely watched chart in global finance. It plots interest rates (yields) across different maturities for bonds of equal credit quality — most commonly US Treasury bonds. Its shape and movements drive pricing for virtually every financial asset, from mortgages to corporate bonds to equity discount rates.
-
Monte Carlo Simulation - JavaScript
IntermediateJavaScript
A pure JavaScript Monte Carlo engine for portfolio simulation and European option pricing via geometric Brownian motion (GBM). Implements correlated multi-asset paths using Cholesky decomposition, antithetic variates for variance reduction, and VaR/CVaR estimation from the simulated return distribution. No external dependencies — runs directly in Node.js.
-
IntermediatePython
This utility does NOT use any external APIs. All calculations are done locally for learning and experimentation.
-
Options Pricing - Binomial Tree
IntermediatePython
Black-Scholes hands you a price but hides the mechanics and **cannot value an
-
IntermediateJavaScript
A pure JavaScript implementation of the Black-Scholes European options pricing model with all five Greeks and implied volatility via bisection. No external dependencies — runs directly in Node.js and can be imported as a module into any JS project.
-
IntermediatePython · JavaScript
This utility does NOT use any external APIs. All calculations are done locally for learning and experimentation.
Risk & Performance¶
Measure what can go wrong and how well a strategy actually performed.
-
IntermediatePython
The Sharpe ratio judges a strategy by how much its returns wobble around their
-
IntermediatePython
When a portfolio is judged against a benchmark, what matters is how much it beat the benchmark by — and how reliably. These are the core metrics of active management: active return, tracking error, Information Ratio, and the appraisal ratio.
-
Finance - Performance Attribution
IntermediatePython
Brinson decomposition splits portfolio active return into allocation and selection effects — answering "did we beat the benchmark by picking the right sectors or the right stocks?"
-
IntermediatePython
This module gives you quick, professional stats about risk in any list or array of investment returns. It's used by investors, analysts, and students everywhere!
-
Risk Metrics - Drawdown Analysis
IntermediatePython
Comprehensive drawdown metrics for quantifying portfolio loss risk over time. Drawdown measures capture both the depth and duration of losses — dimensions VaR ignores.
-
IntermediatePython
Stress tests answer: "What happens if 2008 repeats?" or "How big a shock kills the portfolio?" Required by Basel III, CCAR, and most institutional risk frameworks.
-
IntermediatePython
This utility offers easy-to-use Python functions to calculate Sharpe and Sortino ratios for financial returns. These ratios help you understand whether a series of investment returns is attractive on a risk-adjusted basis.
-
IntermediatePython
Value at Risk is the single most widely quoted number in financial risk
Portfolio Management¶
Construct, optimise and rebalance multi-asset portfolios.
-
Monte Carlo Portfolio Simulator
AdvancedPython
This utility helps you forecast possible futures for a portfolio using random simulations—a key idea in finance, risk management, and statistics!
-
AdvancedPython
This folder contains utilities for portfolio management, risk analysis, and investment optimization.
-
Portfolio Management - Black Litterman
AdvancedPython
The Black-Litterman (1990) model addresses the instability of mean-variance optimization by blending market equilibrium returns with investor views using Bayesian updating.
-
Portfolio Management - Risk Parity
AdvancedPython
Risk parity builds a portfolio where every asset contributes the same amount of risk to the total — not the same amount of capital. A naive 60/40 stock/bond portfolio is ~90% equity risk despite being only 60% equity capital; risk parity fixes that imbalance.
-
AdvancedPython
This utility helps you find the best mix of assets for a portfolio, balancing risk and return using the foundation of Modern Portfolio Theory (MPT).
-
AdvancedPython
This utility uses the yfinance API to fetch current prices automatically. All other calculations and data are managed locally for learning and experimentation.
Strategies¶
End-to-end trading strategies with signals, backtests and execution.
-
AdvancedPython
This utility does NOT use any external APIs. All trades and portfolio data are managed locally for learning and experimentation.
-
Strategies - Backtesting Engine
AdvancedPython
A backtest answers one question: *if I had traded this rule, what would have
-
AdvancedPython
Implementation of the Avellaneda-Stoikov (2008) continuous-time market making model. A dealer posts bid/ask quotes to maximize expected PnL while penalizing inventory accumulation.
-
AdvancedPython
Mean reversion is the statistical tendency for an asset's price to return to its historical average after deviating from it. While Momentum strategies bet on continuation, Mean Reversion strategies bet on reversal — buying when something is "too cheap" and selling when it is "too expensive" relative to recent history.
-
AdvancedPython
Momentum trading is a strategy that capitalizes on the continuance of existing trends in the market. The core philosophy is "buy high, sell higher." If an asset's price is rising strongly, momentum traders assume it will continue to rise.
-
AdvancedPython
This module demonstrates a statistical arbitrage strategy known as Pairs Trading. It identifies two assets that move together and trades the convergence of their spread. When the correlation weakens temporarily, executing trades on both assets allows for capturing profits as they revert to their historical relationship. This quantitative technique relies strictly on mathematical relationships rather than fundamental valuation.
-
Strategies - Statistical Arbitrage
AdvancedPython
This module demonstrates a basic Statistical Arbitrage strategy, specifically pairs trading.
-
AdvancedPython
Trend-following: ride momentum with discipline. Backbone of CTAs and managed-futures funds (AHL, Winton, Man, MLP). Profits from extended directional moves; pays for it during chop.
AI & Machine Learning¶
Data-driven models: random forests, deep learning, RL and NLP for markets.
-
AdvancedPython · JavaScript
Command-line chatbots for Google's Gemini API, implemented in both Python and Node.js. This module demonstrates how to integrate a hosted large language model into a simple interactive application.
-
AdvancedPython
An all-in-one learning hub that delivers progressive Python lessons through both a guided CLI and a hostable Flask web interface. Lessons combine narrative walkthroughs, executable code examples, mini quizzes, and follow-up practice ideas geared toward aspiring quantitative developers.
-
Machine Learning - Feature Engineering
AdvancedPython
The dirty secret of quant machine learning: the model is rarely the bottleneck.
-
Machine Learning - Gradient Descent
AdvancedPython
Gradient descent is the engine inside almost every model that learns. The idea
-
Machine Learning - K-Means Clustering
AdvancedPython
Given a few hundred stocks and their return characteristics, which ones behave
-
Machine Learning - Logistic Regression
AdvancedPython
Linear regression predicts a number. Logistic regression predicts a
-
Machine Learning - Random Forest
AdvancedPython
This module provides a basic implementation of a Random Forest Predictor for quantitative finance. It uses scikit-learn's
RandomForestRegressorto predict time series data or returns based on a set of features. -
AdvancedPython
Applying incredibly sophisticated statistical and advanced computational matrix calculating algorithms to historical sequential asset prices explicitly enables quantitative researchers to discover heavily latent non linear correlation patterns. Standard basic linear techniques lack the internal theoretical mapping memory required to fully process continuous progression data natively. Therefore, explicit sequential data pattern prediction necessitates deeply specialized memory architectures uniquely capable of successfully retaining vast contextual numerical memory safely across thousands of chronologically independent market observations simultaneously.
-
Reinforcement Learning Q Learning
AdvancedPython
This module extensively covers the core mathematical algorithms necessary to construct entirely autonomous quantitative execution agents. Rather than relying on rigid statistical parameters or explicit condition based trading logic, reinforcement learning allows an agent to discover the most optimal sequences of action through continuous simulated trial and error. The intelligent agent dynamically interprets complex environmental states and receives explicit scalar rewards or punitive penalties based directly upon its transactional profitability and risk management threshold maintenance. Over thousands of episodes, the model organically maps the market mechanics to develop a mathematically optimal trading policy without human intervention.
-
AdvancedPython
This utility does NOT use any external APIs. All sentiment analysis is done locally using a simple rule-based approach for learning and experimentation.
Market Microstructure¶
Order books, spreads and the low-latency mechanics of how trades happen.
-
AdvancedPython
High Frequency Trading (HFT) encompasses algorithmic strategies that execute a large number of orders at extremely high speeds — typically microseconds to milliseconds. HFT firms compete primarily on latency: the fastest participant to react to new information captures the profit.
-
AdvancedPython
Market microstructure studies how trading mechanisms — the rules, protocols, and participants in a market — affect price formation, liquidity, and transaction costs. Understanding microstructure is essential for designing realistic execution algorithms, building order books, estimating market impact, and analysing bid-ask spreads.
Utilities & Tools¶
The plumbing: data ingestion, logging, FX, calendars and helpers.
-
BeginnerPython
This folder contains core mathematical and date/time utilities that form the foundation for quantitative finance calculations.
-
BeginnerPython
This utility does NOT use any external APIs. All exchange rates are entered manually for learning and experimentation.
-
BeginnerPython
This folder contains utilities for data processing, validation, and manipulation in financial applications.
-
BeginnerPython
This utility does NOT use any external APIs. All data is managed locally for learning and experimentation.
-
BeginnerJavaScript
A Node.js script that fetches historical bars (OHLCV data) for stocks or crypto from the Alpaca Market Data API. It prompts interactively for the symbol type, symbol, timeframe, and date range, then prints the results as JSON.
-
BeginnerPython · JavaScript
A pair of minimal, dependency-light logging utilities implemented in both Python and JavaScript. Each supports adding, reading, editing, and deleting log entries through an interactive command-line menu. All entries are persisted to a plain-text
log.txtfile in the working directory. -
BeginnerPython
This folder contains utilities for processing, analyzing, and fetching market data for financial applications.
-
BeginnerJavaScript
This utility provides a Google News headline scraper using the
google-news-jsonpackage. It no longer requires any API keys, making it ideal for beginners who want to experiment with news-driven trading ideas or sentiment analysis without signing up for external services. -
BeginnerPython
This folder contains utilities for system-level operations, file management, and configuration in financial applications.
-
BeginnerPython
This project provides WebSocket clients for connecting to various financial data providers, including YFLive and Finnhub. These utilities are designed for real-time market data streaming and analysis.