Crudely Optimising an Oil Refinery
Crudely Optimising an Oil Refinery
By Daniel Nunns · Feb 28, 2026 · 13 min read
This article scratches the surface of how oil is used and traded within the world’s energy complex. We introduce linear optimisation utilising AMPL to understand the optimal outputs from a fictitious refinery.
Macroeconomics with Gaussian Mixture Models
Macroeconomics with Gaussian Mixture Models
By Dr. Adrian Letchford · Nov 20, 2025 · 21 min read
Returns can be viewed as a product of an underlying market regime. This article models those regimes and shows how to extend the model with macroeconomic variables to link regimes to observable economic indicators.
Conditional Value at Risk
Conditional Value at Risk
By Dr. Adrian Letchford · Sep 5, 2025 · 20 min read
A practical crash course on conditional value at risk. Why it beats value at risk, how to estimate it from real data, and how to optimise portfolios with it. Complete with working code.
Modelling the yield curve of US government treasuries
Modelling the yield curve of US government treasuries
By Dr. Adrian Letchford · Feb 13, 2025 · 9 min read
I show you how to build a factor model of US treasury yields. The factor model captures fundamental features of the whole yield curve.
Key insights: Imbalance in the order book
Key insights: Imbalance in the order book
By Dr. Adrian Letchford · Oct 1, 2023 · 5 min read
I summarise key insights from a few papers studying the limit order book. You’l learn how to measure volume imblanace in the limit order book and how well it predicts price moves.
Forecasting currency rates with fractional brownian motion
Forecasting currency rates with fractional brownian motion
By Dr. Adrian Letchford · Aug 9, 2023 · 5 min read
Fractional Brownian motion is a stochastic process that can model mean reversion. Predicting future values turns out to be a simple linear model. This model has significant predictive power when applied to currencies.
Mean reversion in government bonds
Mean reversion in government bonds
By Dr. Adrian Letchford · Apr 8, 2023 · 5 min read
Using the Ornstein–Uhlenbeck process, you can calculate the expected spread between bond yields of different maturities. These expected values can then be used to estimated the expected value of treasury ETF spreads.
Calculating the mean and variance of bond returns
Calculating the mean and variance of bond returns
By Dr. Adrian Letchford · Apr 5, 2023 · 4 min read
Bond returns are a function of yields. Calculating the expected value of this function is quite difficult. You can take a Taylor expansion to make calculating the mean and variance of returns much easier.
How to get 100 years of bond ETF prices
How to get 100 years of bond ETF prices
By Dr. Adrian Letchford · Nov 24, 2022 · 4 min read
The price of a bond ETF can be estimated from bond yields. You can use this technique to create a long term performance history of an ETF.
Understanding bond ETF returns
Understanding bond ETF returns
By Dr. Adrian Letchford · Nov 21, 2022 · 7 min read
The return of a bond ETF can be estimated from bond yields. The distribution of a bond ETF’s returns turns out to be a function of the interest rate, expected change and variance of the interest rate. Bond returns are skewed depending on the interest rate’s level.
Invest regularly
Invest regularly
By Dr. Adrian Letchford · Dec 22, 2020 · 4 min read
Successful investors combine lots of simple things, each one providing a small improvement. One of these simple things is investing regularly.
Measuring performance
Measuring performance
By Dr. Adrian Letchford · Jun 12, 2020 · 8 min read
How can you measure performance when investing? You might think you can simply measure how much money you make. However, this can lead to losing a large portion of your capital. I want to show you why that can happen and how I measure my own investment performance.