← reflections

why i built a clearing engine i'll probably never run in production

2026.05 · rust, clearing & settlement, event sourcing

i kept reading the phrase "the clearing house novates the trade" and realising i didn't actually understand it. so i built one. open clearing engine takes executed trades and runs them through the same pipeline a real clearing corporation uses — novation, position keeping, multilateral netting, settlement — with a span risk engine on top.

the thing that surprised me wasn't the finance. it was how much the correctness requirements shape the code. i made it event-sourced and deterministic not because it's fashionable, but because that's the only way to replay a settlement run and prove it produces a byte-identical result. once you pin a golden output file and refuse to let the engine drift from it, you stop trusting your own assumptions and start trusting the tests.

i'll never run this against real money. that was never the point. i wanted the concept to live in my hands instead of in a textbook, and now it does.


written by dharun ashokkumar · more reflections