From Code to Quant
A Software Engineer's Guide to Stochastic Calculus through Shreve's Lens
SOFTWARE ENGINEERINGOur introductory article, "Energy Trading 101 (UK Edition)", covered the practical business of UK energy trading: pipelines, power stations, and profiting from the weather. That's the "what." This article looks behind the curtain at the "how." And the "how" often involves some frankly terrifying maths.
As a software engineer wading into quantitative finance, you soon find that your world of if/else statements and predictable state machines is gone. In its place is a world where randomness is not a bug to fix. It is the main feature. The maths of this weird new place is stochastic calculus. And the dog-eared guidebook many aspiring quants end up staring at, in mild panic, is Steven Shreve’s two-volume epic, "Stochastic Calculus for Finance".
Your if/else logic won't work here
Think of it this way. Standard calculus is about modelling things that change smoothly and predictably, like a rocket's trajectory. Stochastic calculus is the maths for things that wiggle. And in finance, everything wiggles. Stock prices, interest rates, the price of natural gas - they all move with a maddening element of randomness.
You can't just write if (price > 100) { sell(); } because the price isn't a single number; it's a cloud of future possibilities. You need a language to describe that cloud. That language is what Shreve teaches. If you've ever built a Monte Carlo simulation to brute-force a probability problem, you've already whispered the first few words.
Volume I: Learning to walk in a world of coin flips
Shreve, bless him, knows this is brain-melting stuff. So he starts you off gently. Volume I is built around a beautifully simple, almost comically unrealistic model of the world: the binomial model.
Imagine that at every tick of the clock, a stock price can only go up by a set amount or down by a set amount. That's it. It is a world built entirely of coin flips. To a programmer, this should feel cosy and familiar. It's a binary tree. Each path from the root to a leaf is one possible future for the stock price.
The nice thing about this toy universe is that you can derive the main ideas of finance in it without the scary maths. It's a bit like learning the rules of chess with only the pawns on the board.
- Arbitrage: the financial version of an infinite money glitch. Shreve uses the binomial model to show, with clean logic, why a well-behaved market has no sequence of coin flips that prints free money.
- Hedging: building a portfolio in which the 'up' move of one holding cancels the 'down' move of another. You hold a stock, and you also hold a contract (an option) that pays out if the stock goes down. You’ve built yourself a mathematical umbrella.
- Risk-Neutral pricing: this is the strange one. To price an option, you don't care about the actual probability of the stock going up or down. Instead, you invent a pretend set of probabilities, the "risk-neutral" ones. Under them, everything is expected to earn exactly the risk-free interest rate. It feels like cheating, but the maths works, and it gives one clear price for the option. Pricing an option is not about predicting the future. It is about finding a fair price today for the randomness of tomorrow.
Volume II: The real world arrives (brace for impact)
Volume II is where Shreve takes the stabilisers off the bike. The coin flips of the binomial model are sped up until they happen infinitely often, in infinitely small steps. The simple binary tree becomes the terrifying, beautiful complexity of continuous time.
This is the domain of Brownian motion, the Platonic ideal of randomness. The classic analogy is a drunkard’s walk, but it's more like a particle of dust being battered by trillions of invisible molecules. It is the source of randomness in almost every serious financial model.
To work with functions of this wiggly beast, you need a new tool: Itô's Lemma. If you remember the chain rule from A-level maths, this is its big brother who's been going to the gym. It is the rule for differentiating a function of a random process. Unlike the normal chain rule, it has an extra term. The term is there because the wiggles do not cancel out: their squares add up over time, and that sum changes the result.
Oh, and then there's measure theory. For a software engineer, the best analogy is type theory for randomness. A type system stops you from, say, adding an integer to a string. Measure theory is the rigorous base that stops you doing nonsensical things with different kinds of infinity and different kinds of randomness. It's the compiler internals of stochastic calculus. You might not use it every day, but knowing it is there separates the pros from the people whose models blow up.
So, you want me to code this?
Yes, if quant work is what you want. The best part of Shreve for a developer is that the exercises are more than symbol-pushing: many are coding projects in disguise. You can, and should, write Python scripts to:
- Build a binomial tree and price an option.
- Run a Monte Carlo simulation to value a derivative, and check it against the price you worked out with Itô's Lemma.
- Solve, numerically, the stochastic differential equations that describe how a stock price moves.
This is the daily work of a quant developer. You take the theory and turn it into code that is correct, fast and reliable. A trading desk then uses that code to manage billions of pounds of risk.
Moving from the clean, predictable world of for loops to the messy world of stochastic processes is a real change. It needs a different way of thinking, much like the jump from procedural to functional programming. The reward is large: you get the tools to model, price and hedge the uncertainty that runs through financial markets. Shreve's books are your passport.
P.S. One practical tip to make all this feel less abstract: before you even open Shreve, write a tiny Python script. Create a variable price = 100. Then run a for loop a few hundred times, adding a small random number to the price each time (e.g., price += np.random.normal(loc=0, scale=1.0)). Plot the results. That wiggly line on your screen is what the whole field of stochastic calculus exists to describe. Change the scale of the random number (the volatility), and you'll start to feel why it matters so much.
Desks pay £850 a day for developers who understand this.
£850 is the UK contract median for energy trading developers (ITJobsWatch, 2026), and analysts and business analysts who understand the trade are hired for the same reason. The free Fundamentals path takes about a week part-time. If you have a date, an interview, a start, a go-live, say so when you join and Jordan Dimov will give you the reading order. On Premium, Jordan reviews your code and your CV.
Day rates: IT Jobs Watch, UK contracts, six months to 9 November 2026.
"Jordan's in-depth explainers on topics ranging from interconnector flows to viewing gas-fired generators through option frameworks helped me get my role as an analyst on a power and gas trading desk." Tom R.
Aiming for a role? Quant developer · ETRM business analyst · Power market analyst · Trading technology teams
Training a team? A skills check, a programme, or every new hire. See team training
Your employer can pay by invoice. How to ask