Case study · Founder & sole engineer · January 2024 – present

Convexity Labs — a real-time options analytics terminal

Convexity Labs shows options traders where dealers are positioned, in real time. I designed, built and run it alone: live market feeds in, gamma-exposure and order-flow analytics out, every trade archived — deployed on Oracle Cloud and live at convexitylabs.co.ke.

Convexity Labs landing page: 'Trade with the Dealer's Edge' — real-time gamma intelligence
The public landing page. The terminal itself sits behind sign-in.
Role
Founder, sole engineer
Stack
Python · FastAPI · NumPy · Polars · Redis · PostgreSQL / TimescaleDB · React · Docker
Data
Deribit options chain · Binance L2 order book and trade stream
Runs on
Oracle Cloud Infrastructure (ARM) · tag-gated CI/CD

The problem

Market makers who sell options hedge by trading the underlying, and how much they must hedge depends on their gamma exposure (GEX). Where that exposure flips sign, price tends to either pin or accelerate. The inputs are public — the whole options chain and the live order book — but turning them into a view a trader can act on means recomputing Greeks across hundreds of contracts every few seconds and streaming the result without lag.

What it does

How it's built

Ingestion runs as separate processes — one for Deribit, one for Binance — that publish into Redis. A FastAPI service computes the analytics and broadcasts them to the browser over WebSockets, using a binary stream for order flow. A separate worker writes history to TimescaleDB through a write queue, so a slow disk never stalls the live feed. The front end is React with Zustand state and dockable panels that remember each trader's layout.

A backtest harness replays the archive with structural lookahead prevention: a strategy can only see data stamped before the moment it is deciding on, enforced by the replay engine rather than left to the strategy's author.

Making it fast

The first version of the analytics pipeline was plain Python loops. I rewrote the hot paths as vectorised NumPy — broadcasting whole scans at once and aggregating with np.add.at — and measured each change:

CalculationBeforeAfterSpeedup
Gamma-flip finder (500-point scan × 735 contracts, one broadcast)2,895 ms288 ms10×
Gamma exposure aggregated by strike5.34 ms0.41 ms13×
Flip-finder normal-PDF step (SciPy replaced, scan reduced)254 ms30 ms8×
GEX slope (two scalar passes → one vectorised pass)7.8 ms2.4 ms3×

Running it in production

What it shows about how I work

I take a system from an empty repository to something people log into: data ingestion, numerical work, a real-time API, the interface, and the unglamorous production details — deploys, security, health checks. I measure before and after I optimise, and I write down why a hard-to-reverse decision was made.

Exactly how each number is computed, and where it can be wrong, is on the Convexity Labs methodology page.

Written by Peter Njuguna, software engineer in Nairobi. Last updated 25 September 2026.