~/pedramhatef.dev — zsh
pedram@perps:~$ ./audit --whoami

Pedram Hatef

I audit & debug crypto perpetual-futures trading bots.

I find the bugs that quietly drain perp bots — the mispriced stop, the stuck lock, the orphaned order — on dYdX v4, Hyperliquid, and Binance Futures.

dYdX v4 · Cosmos Hyperliquid Binance Futures Python · execution code

/ what i catch

Perp bots rarely blow up loudly. They bleed: a stop-loss placed a few ticks off, an indexer read with no retry, a safety flag that latches on and silently halts trading. I read execution code for exactly these failure modes.

/ how it works

Start free. Most bots have at least one money-losing bug I can point to inside 30 minutes.

STEP 01Free

30-minute review

I read your execution code and flag the top risks I see, live. No charge, no obligation — you walk away with something useful either way.

STEP 02$1,500 · ~1 week

Fixed-scope audit

A full pass over order placement, position lifecycle, and recovery paths. You get a written report ranking every issue by money-at-risk, plus a one-hour debrief call.

STEP 03$100 / hr

Ongoing engineering

Implement the fixes, add the missing guardrails, or build out new execution logic — on call as a second set of hands that already knows your code.

/ incident reports

Two real bugs I traced and fixed in a production multi-asset perp bot on dYdX v4. Both are the kind that cost money silently, with nothing in the logs that screams.

INCIDENT 01 RESOLVED Mispriced TP/SL left a leveraged position unprotected
Situation
The bot computed take-profit and stop-loss triggers from entry price, target PnL, and position size, then submitted them as conditional orders on dYdX v4.
Complication
The trigger math didn't round to the instrument's tick size. A non-conforming price gets rejected — or lands a few ticks off intended. On leverage, a stop sitting at the wrong level turns a capped loss into an open-ended one, and nobody notices until the market moves.
Action
Traced the calculation, corrected the formula (for a short: trigger = entry − targetPnL ÷ size), and enforced tick-size rounding plus pre-submission validation so no malformed or mis-leveled trigger reaches the exchange.
Outcome
Stops and targets now submit at correct, tick-conformant levels every time. The silent "unprotected position" failure mode is gone.
INCIDENT 02 RESOLVED Stale in-flight lock froze trading on a market
Situation
To stop two trades colliding on the same market, the bot held an in-memory lock per symbol — one trade in flight at a time.
Complication
When a trade lifecycle didn't finish cleanly, the lock stayed stuck on. Every later signal hit a 409 already-in-flight, the app reported the backend unreachable, and the bot quietly stopped trading that market until someone restarted it by hand — a silent outage with no auto-recovery.
Action
Diagnosed the stuck lock as an incomplete-lifecycle artifact and added a 30-second lock timeout, so a stale lock expires on its own — turning a manual-recovery halt into a self-healing one.
Outcome
A hung trade no longer freezes a market. The system recovers within seconds, unattended.

/ open source

perps-bot-healthcheck

I packaged these checks into a Python static analyzer that flags fee-blind TP/SL, no-retry indexer reads, sticky safety flags, and orphaned-order risk across a perp-bot codebase. Read the code, run it on your own bot.

github.com/pedramhatef/perps-bot-healthcheck →

/ contact

Running a perp bot and want a second set of eyes on the execution code? The 30-minute review is free — bring your worst-behaving market.