
Two Losses, Two Systemic Bugs - Automated Trading Post-Mortem from OKX and Hyperliquid
Most trading loss write-ups blame the market. This one blames the code. I run two automated trading systems — a momentum breakout strategy on Hyperliquid and a Bollinger Band mean-reversion system on OKX . In the last week, both systems produced losses that were entirely bug-driven. The strategies worked. The execution didn't. Here's exactly what went wrong, how I found the root causes, and what I changed to prevent recurrence. Incident #1: The Double-Open (Hyperliquid, -$6.63) What happened On Feb 25, my BTC LONG position was double the intended size — 0.0019 BTC instead of 0.00095. The stop loss hit at -5.03%, turning a normal ~$3.30 loss into a $6.63 loss. Root cause Two execution paths ran simultaneously: A cron job (scheduled every 30 minutes) detected a signal and opened a position I manually ran the same executor to test something No concurrency guard existed. Both paths called the exchange API, both got filled. The position doubled. The fix Three changes, in order of importance
Continue reading on Dev.to Python
Opens in a new tab


