Claimed result
- Author: Matthew (@BuildwithPublic, ~2.4k followers), who helps lead API trading at the broker Public β a conflict of interest he declares himself ("read my bias accordingly").
- He built TZU Options Scalper, a complete SPY 0DTE options scalping desk (same-day expiry) in short mean-reversion cycles: TypeScript engine, Python research tooling, data and execution via Public's API.
- He deliberately publishes no performance table: the data covers a handful of sessions; a formal read is scheduled at 10 sessions.
- Key numbers published: net round-trip cost +$0.11 of credit per contract; target 3 ticks against risk of 25 ticks β break-even win rate 88.89%; a sweep of 660 exit configurations; the false "winner" collapsing from $114.90 to $26.90 after fixing two bugs; a 12-minute slow window lifting expectancy from +$0.68 to +$1.74 per cycle (over ~90 cycles in 2 sessions).
Proof: medium. Very detailed, self-critical method and numbers, but a tiny sample (two sessions, same regime), the author works for the broker, no real P&L stated. The value lies in the method lessons, not the strategy.
The key idea
An API that "lets you place an order" says nothing about whether it can carry a real automated strategy. Building the desk end-to-end showed that the edge, if any, must come from the trade and execution quality, not rebates; that a parameter search finds your simulator's bugs faster (and more enthusiastically) than it finds an edge; that parameters inherited without checking can be worth more than the ones you optimise; and that an automated system must fail closed (when in doubt, don't trade and stop).
Step-by-step playbook
1. The three-layer architecture
Layer 1 β Regime gate. Before any order routes, the desk decides whether it may be long calls, long puts or nothing. Two signals on daily bars: - DSS Bressert (double-smoothed stochastic); - a Lyapunov exponent computed over a Hodrick-Prescott filtered series across about two years of bars.
They emit BULLISH / BEARISH / NEUTRAL and latch. "Puts only" means no call ever routes; "neutral" means nothing routes.
Layer 2 β Contract scout (strike selection). In 0DTE, strike selection is most of the job, and it's where naive implementations quietly bleed. - First version: selection on a fixed premium band. The data killed it: gamma peaks at the money, always, but ATM premium decays hard through the session β in one captured session the ATM strike went from ~$1.20 in the morning to ~$0.35 by 15:00. A fixed dollar band drifts away from peak gamma exactly as gamma sharpens. Worse: his $1.15 floor left no near-the-money candidate in 10 of 12 bars sampled at 14:00 β the desk "went blind" every afternoon, and he didn't know until he measured. - Current version: selection on a delta band |Ξ| 0.40β0.60 (absolute value, so it works identically for puts and calls). Premium becomes just a tradability floor. Layered filters, read from the chain's greeks on every refresh: minimum gamma, open interest, maximum spread in ticks, session volume, maximum strike distance. - Every rejection is counted and surfaced. Example: too cheap 66, ask cap 153, delta band 14, no quote 72. Reason: "an engine that silently does nothing is indistinguishable from one that is broken". - That instrumentation uncovered a hidden deadlock: the desk was holding a call while the regime had latched BEARISH. Entries were correctly refused, but it would have idled all session: the scout ranks on structure alone (so its top pick could sit on the forbidden side) and the anti-churn dwell timer protected that pick. Two safeguards, each correct alone, combining into paralysis.
Layer 3 β Bracket routing. Each cycle submits a limit entry with an attached take-profit and stop. The broker natively supports OCO (one-cancels-other) and OTO (one-triggers-other): the sibling orders cancel each other without the client refereeing a race.
2. What the API must provide (checklist for choosing a broker for an options bot)
- Full option chain with greeks: delta, gamma, theta, vega, IV, bid/ask with sizes, volume, open interest, per strike. Without greeks in the response the scout is impossible (elsewhere you compute them or buy them from a second vendor).
- Quotes with broker-side timestamps (critical, see Β§6).
- Native OCO and OTO order classes ("first-class" brackets, not emulated).
- Account reads fast enough to enforce a live loss cap.
- Expirations and instrument metadata, so the desk discovers the 0DTE chain itself instead of hardcoding it.
- He never had to fall back to unofficial endpoints or a second data vendor: for same-day expiries that completeness is everything.
3. The number that changes everything: the break-even win rate
- Cost structure measured, not assumed, per contract per round trip: ~$0.02 fees on the buy, $0.03 on the sell, against ~$0.08 rebate per leg β net round trip β +$0.11 of credit before any price movement.
- But one tick on a single-contract position is $1.00 (one cent of premium Γ the 100 multiplier): one tick of spread costs ~9 times the entire credit, on one leg. So the edge must come from the trade, and execution quality matters about an order of magnitude more than the credit collected.
- His cycle targets 3 ticks and risks 25. Net of credit: +$3.11 against β$24.89 β the strategy must be right 88.89% of the time just to break even. That's why one bad stop erases eight good cycles.
- Formula for any "short target, wide stop" scalper: break-even win rate = net loss Γ· (net gain + net loss) = 24.89 Γ· (3.11 + 24.89) = 88.89%. "If you haven't computed yours, that's the first thing to go and do."
4. The backtest that lied: two bugs that invented the winner
- He ran a sweep of 660 exit shapes (target, stop, trailing) over the captured sessions. Apparent winner: 6-tick target + 1-tick trail, +$1.28 per cycle against the live configuration at β$0.23. "Tempting, and completely false."
- Defect 1 β the spread was floating-point noise. The bid was modelled as mid β half the spread. At a 1-tick spread that's mid β half a cent, exactly between two cents; binary floating point doesn't represent it cleanly and rounded down for some prices, up for others. The modelled bid equalled the mid on 50.9% of observations and sat a full tick below on the rest: "not a spread model, a coin flip". Fix: both sides on the tick grid, in whole ticks.
- Defect 2 β the trail was reading the future. Within one observation the simulator updated the running peak, moved the stop to peak β 1 tick and immediately tested whether the bid had reached it. With a 1-tick trail plus the rounding, the stop landed exactly on the bid and filled on the spot: the backtest was selling at the exact high of every bar and recording it as a trailing exit β all 18 profitable exits of the winning cell were this artifact. Fix: a real stop is registered on one poll and can only be taken on a later one β the fill is deferred by one observation.
- After the fixes the winner dropped from $114.90 to $26.90, no better than the same configuration with the trail off.
- Then the answer inverted: all of the top 15 configurations out of 660 use the existing 3-tick target, with an arm distance so high the trail never engages. The trail was the leak, not the target. With it off, the 3-tick target is profitable at every stop width and in every session: about +$0.68 / +$0.92 per cycle, against β$0.57 with the trail live. Trail switched off in production.
- His two caveats: (1) the result rests on a 1-tick spread; at 2 ticks it turns negative (a 3-tick target can't carry a 2-tick spread). From his snapshots, contracts passing the filters quote 1 tick wide about 90% of the time β reassuring but thin. (2) It's about 90 cycles in 2 sessions in the same regime: "a direction to test, not a conclusion"; the live configuration stays unchanged while he collects more sessions.
- Lesson that carries over: when a sweep produces a surprising champion, the first hypothesis should be a modelling/simulator defect.
5. The parameter he never thought to question
- Entries rest on a mean-reversion ladder: five running means of the underlying, ported from a futures engine he trusted β two "fast" over 5 minutes, two "slow" over 30 minutes and a cumulative session mean. The two window lengths had been copied without examination: "they were scenery".
- They were the largest single parameter left in the system. Re-running every session over a grid of lengths: every 12-minute slow window beat every 30-minute one, at all five fast windows tested β not one cell, the entire row. With 5-minute fast + 12-minute slow, expectancy went from +$0.68 to +$1.74 per cycle and stopped-out cycles fell from 7 to 4. Both sessions improved by similar proportions and the cycle count was identical in every cell β it's not extra session time, it's the quality of the level the order rests at. A 30-minute mean is too slow a reference for a contract that lives one session.
- The fast window, by contrast, was unordered noise between 4 and 10 minutes: no evidence to move it. In production: 5 and 12.
- What he can't say: captured sessions are one bar per minute and the ladder gates a rung until it has enough samples, so anything under 4 minutes is unmeasurable (the live desk polls twice a second and samples a one-minute window 120 times: a shorter fast leg is an open question). And 12 minutes is the shortest measurable slow window: "12 wins" might mean "the shortest thing I can test wins".
- Lesson: he spent weeks optimising target and stop, the numbers that "felt like the strategy", while an inherited parameter was worth more than both. Sweep the things you copied in, not just the things you chose.
6. What broke and what he built to defend against it
- Stale quotes.
- Easy version: polling returned quotes 250 ms "fresh", but the broker-side bidTimestamp on the same payload read nearly three hours old: the session had closed. The poll was fresh, the data wasn't. The desk now refuses any quote whose broker timestamp exceeds a freshness threshold and fails closed: no timestamp, no trade.
- Useful version: measuring live, over 14 consecutive samples at 150β300 ms request latency, the median was ~1.8 seconds of age already built into the quote on arrival, with a tail past 2.7 s. Polling adds a few hundred milliseconds; the rest can't be optimised. Against a 3-second ceiling, 5β10% of cycles will always be refused as stale. Honest response: accept the blocked cycles rather than raise the ceiling and rest orders on 4-second-old prices. It's the shape of REST-polled options data, not his bug β and he only knows because the timestamp is in the payload.
- Auth and rate limits: a 401 latches per credential generation instead of hammering; a 429 sets a shared cooldown honouring Retry-After. Above all: never auto-replay a write β a retried order is a duplicate position.
- Ambiguity: a network failure no longer marks the order "rejected" but unknown, then disarms and stops the engine. If you don't know whether the order reached the exchange, the only safe move is to stop and reconcile by hand.
- Single instance: the desk takes an exclusive lock at startup (two engines on one account = a bad day).
- Execution-quality log: quote age, submitβACK latency, cancel/replace latency, signed slippage per cycle. Vocabulary discipline: a broker ACK is not a fill β the log says so in those words.
7. The discipline
- The desk boots stopped and disarmed every session; routing stays off until he explicitly arms it.
- No conclusions from a small sample: the broker returns no intraday bars for an expired option, so every uncaptured 0DTE session is gone forever; the forward log grows by one session per trading day and can't be rushed. Formal read at 10 sessions.
- Still-open questions: whether the stop matters at all (across every width from 20 to 50 ticks it is reached on only a handful of cycles β for now it's insurance, not a tuned parameter); what the real fill distribution looks like (Rule 605 covers NMS stocks, not options: no public dataset, the forward log is the only honest route).
- What he got most wrong: for weeks he described the trail as the edge and the stop as insurance β both ideas came from a simulator selling at the high of every bar; the trail was the biggest drag. And the mean window copied from futures was worth more than all the exit parameters combined.
Checklist that carries over to any trading bot
| # | Check | Where it comes from |
|---|---|---|
| 1 | Compute the break-even win rate with measured costs | Β§3 |
| 2 | Model prices and spread on the tick grid, never at half-ticks in floats | defect 1 |
| 3 | A stop/trail fills only on the next observation | defect 2 |
| 4 | A surprising winner = look for the bug first | Β§4 |
| 5 | Re-optimise inherited parameters | Β§5 |
| 6 | Count and surface every rejection reason | layer 2 |
| 7 | Check that two safeguards together don't create paralysis | layer 2 |
| 8 | Refuse quotes with a stale broker timestamp; fail closed | Β§6 |
| 9 | Never auto-replay an order; error = "unknown" state + stop | Β§6 |
| 10 | Single-instance lock; boot disarmed | Β§6β7 |
| 11 | Log: quote age, latencies, slippage; ACK β fill | Β§6 |
| 12 | No conclusions before a minimum sample fixed in advance | Β§7 |
Tools and costs
| Item | Role | Cost / note |
|---|---|---|
| Public trading API | data (chain with greeks, timestamped quotes) and execution (OCO/OTO) | fees ~$0.02 buy / $0.03 sell, rebate ~$0.08 per leg (per contract, in his case) |
| TypeScript | live engine (polling twice a second) | β |
| Python | research, parameter sweeps, simulator | β |
| Regime indicators | DSS Bressert, Lyapunov exponent on a Hodrick-Prescott filtered series (~2 years of daily bars) | β |
| Self-captured data | 0DTE sessions in 1-minute bars (not recoverable after expiry) | time: one session per day |
| Capital | not stated | 0DTE options: the whole premium can be lost within hours |
Limitations
- No financial result: no P&L, no equity curve; the numbers are per cycle and per contract over ~90 cycles in 2 sessions in the same regime.
- Conflict of interest: the author works for the broker whose API he praises.
- Extreme risk: 0DTE options can lose their entire value within hours; a strategy that needs 88.89% winning trades is fragile by construction (one stop erases eight cycles). This is not financial advice, and neither is this guide.
- The no-trail result depends on a 1-tick spread (at 2 ticks it turns negative).
- Costs and rebates are those of his account and broker; with other brokers or in Europe (different products and rules) the numbers change.
- It takes programming skills, self-captured data and months of sessions to get a meaningful sample.