Skip to main content
Chapter 00May 16, 20267 min read

How to read this tutorial

What the eight chapters cover, who they are written for, and how to use AlphaHub alongside as you go.

Most quant tutorials make one of two mistakes. The first is to start with the mathematics — measure theory, stochastic calculus, the spectral decomposition of a covariance matrix — and bury the reader before any of it touches a price series. The second is the opposite: a tour of "twelve strategies that beat the market," with code that looks impressive in a notebook and silently leaks future information one line at a time.

This tutorial tries the middle path. Each chapter introduces one idea, defines it precisely, shows the smallest piece of code that makes the idea real, and then asks you to run it in AlphaHub on real data. We assume you write Python, you have heard of a backtest, and you have not yet been bitten by survivorship bias. By the end you should be able to read a strategy paper without flinching, build a baseline factor on your own, and recognise the four or five mistakes that cause most "I beat the S&P 500" backtests to be wrong.

Who this is for

The tutorial is written for one specific person: an engineer or scientist who can program, who has a working understanding of statistics at the level of "I know what a t-statistic is, I forget how to compute one," and who wants to take quantitative trading seriously enough to build something rather than only read about it. If you are coming from machine learning the mathematics will feel familiar; if you are coming from discretionary trading the engineering discipline will feel pedantic. Both reactions are correct.

What you do not need:

  • A finance degree. We define every finance term the first time it appears.
  • A market-data subscription. AlphaHub ships with US equity, China A-share, Hong Kong, and crypto data already wired up.
  • A trading account. Nothing in this tutorial sends an order. The last chapter discusses paper trading and live execution, but the first seven stay in research.

What you do need:

  • Comfort with pandas and numpy. We will not explain what a DataFrame is.
  • Willingness to write code. Reading without running is the fastest way to convince yourself you understand something when you do not.
  • A grown-up attitude toward losses. A strategy that "works" 60% of the time still loses money four months a year. If that feels intolerable, this is not a useful skill set.

What the eight chapters cover

The chapters are designed to be read in order, but each is self-contained enough that you can skip around if a topic is already familiar.

  1. What is a quant factor. The unit of construction for almost every systematic strategy. Value, momentum, quality, low-volatility — what each one measures, where they come from in the academic literature, and how to compute a basic version yourself.
  2. What is a trading strategy. How a factor becomes a signal, how a signal becomes a portfolio, how a portfolio gets executed, and the four numbers — Sharpe ratio, maximum drawdown, hit rate, turnover — that decide whether the strategy is worth running.
  3. Backtest pitfalls. Look-ahead bias, survivorship bias, in-sample tuning, ignored transaction costs. The boring discipline that separates a plausible backtest from one that will actually make money next year.
  4. Risk management. Position sizing, drawdown anatomy, correlation regimes, the difference between Kelly and volatility-targeting, and why every quant fund has a story about 2020 March or 2015 June.
  5. Alpha decay. Why every working strategy eventually stops working, how to detect it from monitoring signals before it shows up in the equity curve, and what to do when it does.
  6. A short history of quant. Ed Thorp, D.E. Shaw, Renaissance, LTCM, the 2007 quant meltdown. Useful context, and a sober reminder that the field's smartest people have lost more money than you will ever have.
  7. AI in quant. Where machine learning earns its keep (signal blending, execution, regime detection), where it overfits the moment your back is turned, and how language models are starting to change research workflow rather than alpha generation.
  8. Working in AlphaHub. The platform-specific chapter: sessions, the agent, the backtest engine, the credits system, paper trading. This is the only chapter that ages quickly; we update it on each release.

The first three chapters are the foundation; you should not skip them. The middle three (4-6) are the ones working quants reread every year or two. The last two are honest about the current state of the art and where the floor of "this is useful" actually sits.

How to use AlphaHub alongside

Each chapter ends with one concrete action. Open the workspace, paste the suggested prompt or load the suggested template, and run it. The chapter is calibrated so that doing the exercise takes ten or fifteen minutes and produces a result you can interpret with what you have just read.

A typical workflow looks like:

# 1. Read the chapter.
# 2. Open AlphaHub workspace.
# 3. Either:
#      a) paste the suggested agent prompt, or
#      b) /fork the linked strategy template.
# 4. Look at the equity curve, the metrics card, the per-trade log.
# 5. Change one parameter. Look again.
# 6. Move on to the next chapter.

The agent is there to argue with, not just to take instructions from. If a backtest result looks too good, ask "what would break this," and let it list the assumptions. If a number looks suspicious — a Sharpe above 4, a drawdown below 5%, a hit rate above 65% — that suspicion is usually correct, and we will spend chapter 3 on how to confirm it.

Educational only

Nothing in this tutorial is investment advice. The strategies are simplified for pedagogy; do not run any of them with real money without going through chapter 3 (backtest pitfalls) and chapter 4 (risk management) twice. If you do put real money to work, position it small enough that losing all of it would only cost you embarrassment.

Notation and conventions

To keep code samples short:

  • All time-series are pandas.Series or pandas.DataFrame indexed by DatetimeIndex at daily frequency unless otherwise stated.
  • Returns are simple returns (price.pct_change()) unless we explicitly say log returns.
  • All Sharpe ratios in the tutorial are annualised assuming 252 trading days unless we are looking at crypto, where we use 365.
  • "The universe" refers to the set of instruments a strategy considers. For US equity examples it is the S&P 500; for China A it is the CSI 300; for crypto it is the top 50 by market cap.
  • "Pit data" or "PIT" stands for point-in-time — the dataset reflects what you could have known on that date, not the latest revised value. This distinction is the single most common source of fake backtests.

References across the tutorial follow author-date format and resolve to the bibliography at the end of chapter 7. We cite primary sources (Fama and French 1992, Sharpe 1964, Grinold and Kahn 2000) rather than blog posts wherever possible. A short reading list of three books, four papers and one textbook is in the appendix; nothing else is required.

What you should expect to take away

Reading the eight chapters end to end is roughly fifteen hours of work if you do the exercises and stop to think; less if you skim, more if you go down rabbit holes (and there are many). At the end you should be able to:

  • Read a strategy description in a paper or pitch deck and immediately ask the right three questions about look-ahead, capacity, and cost.
  • Build a factor from a definition, compute its information coefficient on a real universe, and decide whether it is worth building a strategy around.
  • Take a backtest report and identify the parts that are robust versus the parts that are statistical artifacts.
  • Have a structured way to think about position sizing rather than picking a leverage number out of the air.
  • Understand why the field's most successful firms are also the most paranoid about overfitting, and apply some of that paranoia to your own work.

What you will not be able to do at the end: predict the market. Nobody can. The goal is to have a research process that is less wrong than most, calibrate your confidence appropriately, and survive the inevitable strategy failures with enough capital and conviction to ship the next one.

A note on tone

This tutorial is intentionally written like a textbook rather than a marketing blog. We use precise language ("factor" not "alpha-generating signal," "drawdown" not "rough patch"). We name papers and authors. We point out when something we are showing is wrong or simplified. We assume you can handle a definition that takes two sentences instead of two emojis. If this style feels heavy, the trade-off is intentional: most quant content on the open internet is optimised for clicks, and the result is that beginners learn vocabulary that does not survive their first real backtest. We would rather you spend an extra minute on a sentence and not need to unlearn it later.

Try it in AlphaHub

Try the workspace once before chapter 1.

Show me one liquid US equity and plot 200 trading days of close price.
Open workspace

The next chapter starts with the smallest possible definition of a quant factor and builds up to a working momentum calculation. If you have an hour, the goal is to finish chapter 1 and run the momentum signal on SPY by the time you close this tab.