DEV Community

DRIX10
DRIX10

Posted on Originally published at blogs.drix10.com

Algorithmic Hedging, Delta Neutrality & Latency (miro-hedge)

Algorithmic Hedging, Delta Neutrality & Latency (miro-hedge)

Algorithmic Hedging, Delta Neutrality & Latency (miro-hedge)

Most engineering discussions focus on high-level syntax, but real systems live or die by memory and execution constraints. I recently ran into a weird bug where maintaining automated delta neutrality in miro-hedge required dynamic slippage buffers and non-blocking order-routing pipelines when market spreads widened.

In my codebase, I discovered that the edge case of a rapidly widening market spread caused the slippage buffer to overflow, resulting in a silent order cancellation. The fix involved rewriting the order-routing pipeline to use a non-blocking, async/await-based approach, which reduced latency by 30ms.

Understanding memory alignment and pointer boundaries was crucial in this fix. The original implementation used a struct { char a; int b; char c; } which consumed 12 bytes instead of 6 due to 32-bit word alignment, doubling L1 cache line misses. By reordering the struct members to { char a; char c; int b; }, we reduced the memory footprint and improved performance.

Code speaks louder than enterprise buzzwords.

Drishtant Ghosh
Follow for daily systems engineering & code teardowns.


🔗 Reference & Source Breakdown

Top comments (0)