Agentic Trading Index

Why broker sandboxes lie about live execution

Trading terminal showing order status, illustrating broker sandbox limits
Photo by Rafael Minguet Delgado on Pexels

Two operators, one sandbox, opposite calls

One operator sends a market order through a broker sandbox, sees a full fill at the displayed price and approves live deployment. Another runs the same test, notices that every order fills immediately and treats that as evidence the sandbox cannot validate execution risk. The first calls the result a pass. The second calls it a plumbing test.

The second call is safer. A broker sandbox can confirm that authentication works, an order request has the right fields, and the client can process a status update. It often cannot reproduce the live path from quote to venue, including queue priority, partial fills, market impact, buying-power checks and volatile-period latency. "Lie" describes the mismatch, not necessarily deliberate deception. The sandbox may be doing exactly what it was built to do: simulate a successful API workflow.

Consider a representative deployment: an unattended agent trades liquid listed shares, sends marketable limit orders of 400 shares, and can issue a few dozen orders in a session. Those are example parameters, not a report of a particular operator's results.

In the sandbox, the agent gets a complete fill and updates its position. Live, the same limit may fill only partly, remain open while the signal changes, or be rejected because buying power has moved.

The practical question is not whether the sandbox works. It is which behaviours it can establish, which it approximates, and which need a separate test. Treating those as distinct evidence categories prevents an API smoke test from becoming an execution sign-off.

Follow one order through the parts the simulator skips

Start with a signal that asks for 400 shares. The agent reads a quote, calculates a limit, submits the order, waits for an acknowledgement, and records the resulting position. A sandbox may return an acknowledgement and a full fill against a convenient price snapshot.

That proves request construction and basic state handling. It does not prove the quote was fresh enough, the order would have joined a live queue, or the same quantity was available at that price.

In live trading, a marketable limit order can execute across several price levels. A partial fill is not a failed order. It is an open exposure that the agent must manage.

If the process times out after submitting, the order may still have reached the broker. Retrying blindly can create a duplicate position. Use a stable client order ID where supported, query order status after ambiguous timeouts, and reconcile executions against the broker's position and open-order endpoints before resubmitting.

Order state deserves its own tests. A useful state machine distinguishes pending submission, acknowledged, partially filled, filled, cancel requested, cancelled and rejected. A cancel request is not a cancellation confirmation. A fill can arrive while cancellation is in flight. If the agent assumes the sequence is always submit, fill, then response, it can miss these races and report a position that does not exist.

Brackets and OCO orders need similar scrutiny. Some APIs provide native linked orders; others emulate them in the client. In an emulation, a disconnect between entry fill and protective-order submission can leave the position unprotected.

Test the failure path deliberately, including a rejected exit, a delayed acknowledgement and a process restart. For a live unattended system, recovery and reconciliation matter more than a visually clean sandbox trade.

Price inputs also differ. A simulator may use a delayed quote, a last trade, or a simplified fill rule.

A live order may meet a wider spread, a halt, a fast move or a venue-specific restriction. The agent should track quote timestamp and age, reject stale inputs against a strategy-specific threshold, and avoid assuming that a price shown in the sandbox is executable.

Benchmark the gap, not just the happy path

The ranges below are typical market ranges for orientation, not audited results for any broker. Actual behaviour varies by API, asset, order size, venue, market conditions and account. The live examples assume ordinary retail API access and liquid instruments; thin markets and stressed periods can sit well outside them.

BehaviourSandbox, typical rangeLive, typical rangeWhat to verify
Order acknowledgement10-100 ms, often consistent50-500 ms normally, 0.5-5 s during congestionMeasure round-trip time and handle timeouts as unknown status
Market-order fillImmediate to under 100 ms, often fullPartial or staged fills over milliseconds to secondsTrack execution quantity, average price and remaining quantity
Slippage on a small liquid orderOften zero or a fixed simple adjustmentAbout 1-10 basis points in ordinary conditions; more in fast marketsCompare decision quote with each execution, not only the final average
API request limitsOften generous or absentCommonly around 1-50 requests per second, depending on endpointTest throttling, backoff and recovery without losing order state
RejectionsOften limited to malformed requests or scripted casesCan range from rare to repeated under risk, session or data constraintsParse reason codes and stop unsafe retry loops

A single benchmark score hides where the gap sits. Record separate measures for acknowledgement latency, fill latency, fill ratio, slippage, rejection rate, cancel confirmation time and reconciliation differences.

Keep percentiles, not only averages: p50 latency can look healthy while p99 delays leave an agent acting on stale state. Log the request, client order ID, broker order ID, timestamps, quote snapshot, every status transition and each execution.

For a representative 400-share order, a sandbox test might return one fill event for all 400 shares. A more informative harness also feeds the agent a 150-share partial fill, a delayed remainder, a cancel acknowledgement that arrives after another fill, and a rejection with a reason code.

These are test fixtures, not claims about expected broker performance. They expose whether the agent can keep its internal position aligned with the broker's actual state.

Build tests around failure and uncertainty

Where the broker offers no realistic market simulation, build a local execution harness or use a paper environment whose behaviour can be configured. Agentic Trading Index offers agentic paper trading from $9.99 a month; whichever environment is used, check what it models before treating its results as execution evidence. A simulator can inject delays, partial fills and rejects, but it cannot reproduce every venue's queue or every broker's risk engine.

Test the agent's decisions under controlled variations. Keep the strategy signal fixed while changing one execution condition at a time. This makes it easier to find whether a failure comes from order logic, stale data or a broker response.

  • Delay acknowledgements across typical ranges such as 100 ms to 2 seconds, then verify that a timeout triggers a status query rather than a duplicate order.
  • Return partial fills, including a small initial execution and a larger remainder, and check that risk limits use filled quantity plus genuinely working quantity.
  • Reject orders for buying power, invalid quantity, market closure and rate limiting. Confirm that the agent classifies each reason and applies bounded retries only where safe.
  • Drop the connection after submission, restart the process and reconcile open orders, executions and positions before allowing new risk.

Then run a small, controlled live validation only if account permissions and the operator's risk policy allow it. Use minimum practical size, liquid instruments and explicit order, loss and exposure limits. A live probe is not a strategy trial. It checks API behaviour in the real account, and must have a kill switch that cancels working orders where possible and prevents new submissions.

Before that probe, define what counts as a stop condition. Examples include an unknown order state beyond a set timeout, a position mismatch, repeated rejections, stale market data, a breached request limit or a protective order that is not confirmed.

Choose thresholds for the strategy and broker rather than copying a generic number. In a system with no human watching, the stop behaviour is part of the order protocol.

Make deployment depend on evidence, not a green status

Separate the sign-off into three claims. First, the client can authenticate, submit valid requests and parse responses.

Second, the agent can preserve correct state through partial fills, timeouts, cancels, rejects and restarts. Third, the live execution costs and failure rates remain within the strategy's risk budget. A sandbox can support the first claim and help test the second. It rarely establishes the third on its own.

Set a risk budget in operational terms. For example, define the maximum unconfirmed order exposure, maximum order age, allowed slippage before cancellation, and maximum difference between local and broker-reported positions. A strategy may tolerate a few basis points of slippage on a liquid instrument but not an order that stays live after its signal has reversed. The correct thresholds depend on expected edge, liquidity and the cost of being wrong.

Use a deployment checklist that records evidence, not just pass or fail:

  • Confirm whether sandbox prices are live, delayed, synthetic or based on last trades, and record the fill model's assumptions.
  • Verify idempotency, order-state transitions, cancel races, restart recovery and position reconciliation.
  • Measure latency percentiles, partial-fill handling, slippage and rejection behaviour in separate tests.
  • Document live limits, alerts, kill-switch behaviour, restart policy and who or what can restore trading after a stop.

Paper trading is still useful. It can expose invalid order fields, bad sizing, broken state transitions and some strategy logic errors without risking capital.

It is also useful for regression testing: replay the same event sequence after each change and check that order decisions and internal state remain consistent. The mistake is asking it to certify execution conditions it does not model.

Keep the distinction in the release record: sandbox pass means the integration passed its simulated contract; it does not mean live orders will fill at displayed prices or arrive within a fixed time. The mistake most readers will still make after reading this is treating a clean sandbox fill as evidence that live execution is safe.

Frequently Asked Questions

What does a broker sandbox actually test?

It usually tests authentication, request formats, basic order submission and response handling. Depending on the broker, it may also simulate fills and account state, but those simulations do not establish live queue priority, slippage or venue behaviour.

Why do sandbox orders fill differently from live orders?

Sandboxes often use simplified fill rules and may not model available liquidity, queue position, market impact or changing prices. Live orders also pass through account risk checks and market conditions that a simulator may not reproduce.

How should an agent handle an order timeout?

Treat a timeout after submission as an unknown order state, not proof that the broker did not receive the order. Query by client order ID or broker order ID, reconcile status and executions, then decide whether another submission is safe.

Can paper trading validate slippage?

It can estimate slippage if its price and fill models are explicit and reasonably suited to the instrument and order size. It cannot establish live slippage with certainty, so compare paper estimates with carefully controlled live observations where permitted.

What should be tested before unattended live trading?

Test partial fills, delayed responses, rejects, cancel races, rate limits, disconnects, restarts and position reconciliation. Also define hard limits for stale data, unconfirmed exposure, slippage and the conditions that stop new orders.