Linear products — forwards, futures and swaps — are priced by discounting and no-arbitrage. Only nonlinear payoffs — options — need stochastic calculus. That is the claim this site is organised around, and every page after this one is a piece of it.

What linear means

A product is linear when its value moves in fixed proportion to the price of its underlying. A forward to buy a share in a year is the plain case: if the share pays no dividend and goes up a pound, the forward is worth a pound more, whether the share is at 50 or at 500. Draw the payoff at expiry against the share price and you get a straight line. A future is a forward with an exchange and a clearing house around it. A swap is a series of payments on an interest rate, each a fixed amount less a floating one, so each is linear in the rate it is fixed against.

The price of a linear product falls out of a replication argument, and there is no probability anywhere in it. Buy the share today with borrowed money and hold it for the year. At the end you own the share and owe the loan, which is exactly what the forward delivers. Two positions that pay the same in every possible future must cost the same today, or you would buy the cheap one, sell the dear one and keep the difference with no risk. So the forward price is the spot price plus what it costs to carry the share for a year — interest paid, less income received — and nothing else. Nowhere in that argument did you need to know where the share price is going, how much it moves, or how likely any outcome is. The replication is exact whatever the price does, so no model of the price is needed. 1.0 supplies the discounting and 1.1 does the forward properly.

What nonlinear means

An option's payoff bends. A call on the share pays the excess of the share price over the strike if there is any, and nothing otherwise: a flat line that turns into a rising one at the strike. No fixed holding of share and cash pays that in every future — a holding that matches the option when the share is well above the strike is far too large when it is well below. The hedge that matches the option today has to change as the price moves, and keep changing for the life of the contract. What that changing hedge costs to run depends on how much the price moves about — its volatility — which is a statement about the whole path the price takes, not about any single price. That is where probability enters, and it cannot be argued away.

Payoff at expiry against the share price, for a forward to buy the share at 100 and a call struck at 100.
forward to buy at 100
payoff1000−100050100150200share price at expiry
call struck at 100
strikepayoff1000−100050100150200share price at expiry
The forward’s line is straight: one holding of the share matches it at every price. The call’s is a flat line that turns into a rising one at the strike, and no fixed holding matches both parts.

Nonlinear does not mean harder sums. It means the hedge changes as the price moves, and a hedge that changes has a running cost that a hedge that stands still does not. The option's price is that running cost — 1.4 makes this the way into Part 2 — and computing it for a price that moves randomly in continuous time is what stochastic calculus is for. Part 2 opens by measuring how a randomly moving quantity spreads out over time, because that spread is what the changing hedge is exposed to.

Why a developer should care

The distinction predicts which systems are hard, and where.

A linear book is valued by discounting cash flows off a curve. The maths is a sum. What is hard is everything around the sum: building the curve from market quotes, the day-count and compounding conventions that move a number by a basis point and a P&L by a great deal more, fixings and resets and netting and collateral, and the volume of events a swap generates between trade date and maturity. Its risk is a set of sensitivities to points on the curve, and those change slowly. A swaps system is mostly a data and lifecycle problem.

An option book is valued by a model whose most important input, volatility, is not observable on its own. It is implied from the prices of other options and carried around as a surface that someone has to own. The book's risk changes as the market moves — that is what nonlinear means — so a risk report is out of date the moment the market does, and the overnight batch reruns everything. An options system is mostly a compute and calibration problem, and it is where model libraries, Greeks, volatility surfaces and Monte Carlo farms come from.

That is a rule of thumb, not a law. But it is the first question to ask about any pricing system you are handed — is the product linear? — and 1.3, 1.5, 3.4 and 3.6 fill in the answer.

The map

The site has five parts.

Part 0 — Orientation. 0.1 says why the instruments exist. This page states the thesis and maps the rest. 0.3 is the reference: the notation ledger — every symbol that trips a working developer, with what it means here and what it must not be confused with — plus units, prerequisites and how to run the code.

Part 1 — Products. One page per product: what it is, who needs it and why, how it is priced, how it is risked, and its lifecycle from booking to settlement. 1.0 is cash and discounting, which every later page uses. 1.1 forwards, 1.2 futures and 1.3 swaps are the linear half of the thesis. 1.4 options is the nonlinear half, and its closing claim — the price is the cost of hedging — is the door into Part 2. 1.5 is the trade lifecycle and the risk system: what happens to a trade between capture and reporting, and which system owns each step.

Part 2 — Stochastic calculus. The learning starts here. Eleven pages take a randomly moving price from a discrete random walk (2.1) through Brownian motion, quadratic variation, the Itô integral and Itô's lemma (2.2–2.5) to the stochastic differential equation a price follows (2.6), the hedging argument and the PDE (2.7), risk-neutral pricing (2.8), the Black–Scholes formula and its Greeks (2.9–2.10), and the places the model breaks (2.11). Every rule is verified numerically before it is derived: each page has a numpy experiment behind it, the experiment's results are committed, and the same invariants become the tests of Touchstone, the C++ pricing library that Part 3 is written against.

Part 3 — Implementation. The same results as code, with what goes wrong when you write them: the closed form and its edge cases (3.1), Monte Carlo and its error bars (3.2), finite differences on the PDE (3.3), implied volatility and the surface (3.4), Greeks as they appear on a risk report (3.5), where a pricing library sits in the system (3.6), and reading QuantLib, the reference implementation Touchstone's prices are checked against (3.7).

Part 4 — Later. Candidates for a second version, not commitments: volatility surfaces properly, local and stochastic volatility, jumps, rates and curve building, exotics, American options in depth, counterparty credit and CDS. Nothing in Part 4 has a page. The list says what v1 does not cover.

Everything in Parts 2 and 3 is done for one underlying, with a constant rate, a constant volatility, a dividend yield and European exercise. That is the whole of v1's scope, and a claim that goes beyond it is not on this site.

How to read a demo

Demos sit inside the pages, under the prose that explains them, and each carries an id and a title in its header. A demo runs in your browser, and nothing you put into it is sent anywhere. Where a demo draws random numbers it takes a seed, and the same seed gives the same picture every time. Change the seed and you get a different sample from the same process. That is how to tell structure from noise: a result that survives a change of seed is a property of the process, and one that comes and goes with the seed is sampling noise. Where a demo computes a number, the number is printed as text beside the chart, and a Monte Carlo mean is never shown without its standard error. Every control works by touch, and every value is visible without hovering.

Predict first. Before you move a slider, decide what you expect to happen and write the number down. Then run it. Several of the wrong answers in this site's checks are predictions that were made in earnest before the experiment behind the page was run, and the demo is where you find out whether yours was one of them.

How to read a check

Every page ends with a check: three to six multiple-choice questions. A check is not a test with a score. Its job is to fail if you have misunderstood the page, and to say how. Every wrong option was written to encode one specific misconception, and the feedback on it says why it is wrong. So a wrong answer is worth more to you than a right one: it names the belief to fix. Choose an option and the feedback for that option appears, with the correct option marked; the question then locks, because a second guess would tell you nothing. Your answers are kept in your browser's local storage and nowhere else — there is no account and no server — and the index has a control to reset them.

Where to start

If you have never met a swap, start with Part 1 and read it in order. If you know the products and want the maths, start at 2.1. It assumes the probability a developer already has — variances add across independent things, and the central limit theorem — and 0.3 lists the rest. Either way, do the checks.

Check

Why can a forward be priced without any model of how the underlying moves, when an option cannot?

A desk has sold a call option and hedges it by holding some of the underlying. The underlying’s price rises. What happens to the hedge?

A colleague says: "Our swaps system is huge and our exotics system is small, so swaps must be the harder maths." What is the better reading?

You move a slider on a demo and the result changes. How do you tell whether what you saw is a property of the process or noise in the sample?

You answer a check question and get it wrong. What has the page just given you?