Menu

My “price converges at expiry” code passed its unit test, was wrong by 26 points, and then the fix exposed a free arbitrage, post-mortem.

#defi#redditdefi#price#target#drift
Reading 0:00
15s threshold

I’ve been building a pricing engine for a short-lived derivative: a two-sided token pair that lives for ~90 minutes while a live football match is played, and has to settle at the end against a deterministic index. The quote is produced off-chain at 10 FPS and pushed to an AMM through a signed oracle. Think of it as a 90-minute option whose underlying is “how the match is going”.

The design requirement sounds trivial: in the last ~10% of the match, the visible price has to converge to the settlement value, so that what you see when you close is roughly what you get paid. North-star metric: divergence under 0.5 cents at full time.

Here’s how that one requirement produced three bugs, each one hidden by the previous one.

Bug 1: the test proved something the engine never ran

The spec described convergence as an accumulative pull:

decayFactor = (t - t_activation) / (T - t_activation) tau = (implied - P) * decayFactor * 0.5 P <- P + tau # every tick

Iterate that and you reach implied .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.