Agentic Trading Index

Measuring execution costs for an unattended trading agent

Trading terminal showing market quotes, relevant to measuring execution costs for an automated trading agent
Photo by Rafael Minguet Delgado on Pexels

Operator A sees a buy signal and sends a marketable order, accepting the current ask to reduce the chance of a missed fill. Operator B sees the same signal and posts a limit order at the bid, aiming to avoid paying the spread. A may pay more upfront but get certainty sooner. B may save on the quote and then miss the move, or get filled just before the price falls. A useful cost model has to measure both outcomes, not just the price visible when the agents made their calls.

For an unattended agent, execution cost is not one number returned by a broker. Spread, commission and slippage have different mechanics, and some measures overlap. Set a consistent definition before comparing strategies or venues. Otherwise, a model can count the spread twice, miss fees, or label an unfilled order as free execution.

Separate the costs before adding them

Spread is a quote, not a bill

The quoted spread is the difference between the best ask and best bid. Divide it by the midpoint and multiply by 10,000 to express it in basis points.

A marketable buy at the ask or sell at the bid usually pays about half the spread relative to the midpoint at that instant. A passive order may earn some or all of that spread if it fills, but it can also face adverse selection: the market may move against the resting order just before or after execution.

Spread changes with instrument, time of day, volatility, venue and order size. The following are typical market ranges in ordinary liquid conditions, not a promise about a particular broker or instrument. Wider markets, news and thin sessions can exceed them.

Instrument and unitQuoted spread, typical rangeCommission, typical rangeAdverse slippage per marketable order, typical range
Liquid US equities, regular session1 to 5 bps$0 to $0.005 per share, per side0 to 3 bps
Major FX pairs0.1 to 1.0 pips0 to 0.7 pips round trip0 to 0.5 pips
Liquid crypto spot pairs1 to 10 bps2 to 10 bps per side1 to 15 bps
Liquid index futures0.25 to 1 tick$1.50 to $5 per contract round trip0 to 1 tick

These ranges are starting points for test design. They are not directly comparable until units and conventions match. Equity commissions per share, FX pips per lot and futures fees per contract need conversion to the same notional or risk basis. A 0.5 pip cost on a small FX position is not the same dollar amount as 0.5 pip on a large one.

Commission is explicit, slippage needs a benchmark

Commission is the cash fee charged for a trade. Record broker commission, exchange fees, regulatory charges and any rebates as separate fields.

A maker rebate can reduce the explicit fee, but it does not establish that the passive fill was good. Include fees on each partial fill and reconcile them against the final account statement, since reported estimates and final charges can differ.

Slippage describes the difference between an execution price and a reference price. The phrase is ambiguous unless the reference is named.

A fill compared with the decision price includes market movement and delay; a fill compared with the midpoint when the order reached the market is closer to execution quality. State the benchmark in every metric, report and alert.

Measure each order against a timestamped benchmark

Use signed costs and keep components distinct

For a fill, let the side be +1 for a buy and -1 for a sell. Let the arrival midpoint be the midpoint captured when the order leaves the agent, and let the fill price be the execution price.

Signed adverse execution in basis points is side multiplied by fill price minus arrival midpoint, divided by arrival midpoint, then multiplied by 10,000. Positive values are costs; negative values indicate price improvement against that benchmark. Calculate it for each fill, then aggregate by quantity or notional rather than taking a simple average of orders.

This measure already captures the fill's price relative to the arrival midpoint, including spread paid or captured and price movement between arrival and fill. Do not add the full quoted spread to it. Track the quoted spread separately as market context, and add explicit fees separately to get a cash-inclusive execution cost. If the strategy also needs the delay from signal to order arrival, compare the decision midpoint with the arrival midpoint as a separate component.

For a limit order, a fill below the midpoint on a buy can look like price improvement at the instant of execution. That does not show whether the fill was adverse. Record markouts, such as the midpoint 1 second, 10 seconds and 60 seconds after the fill, and compare those prices with the fill. The right intervals depend on the strategy horizon. Markouts help identify fills that arrive just before an unfavourable move, but they are not a substitute for the cost benchmark.

Capture the event trail, not only the final fill

A useful measurement record lets an engineer reconstruct the decision and order lifecycle. Keep timestamps from a monotonic clock for local elapsed time, plus exchange or broker timestamps where available. Preserve the quote snapshot used for the decision and the quote at order release; otherwise, measured slippage can be confused with stale data or network delay.

At minimum, log these fields for each order and fill:

  • Instrument, side, requested quantity, order type, limit price and time-in-force.
  • Decision, submission, acknowledgement, fill, cancel and reject timestamps.
  • Bid, ask, midpoint and displayed size at decision and arrival.
  • Fill quantity and price, venue if supplied, fees, rebates and order state.
  • Strategy and agent version, plus a stable order identifier linking events and retries.

Keep rejected and cancelled orders in the dataset. They reveal whether the agent is using invalid prices, sending stale orders or cancelling too quickly. Keep unfilled limit orders too: a cost report that only includes fills will overstate the value of passive execution by ignoring opportunities the agent never captured.

Build a cost model from fills, not a single average

Report spread, fees, arrival-price slippage and post-fill markouts separately before calculating an all-in figure. Break the results out by instrument, side, order type, size, time of day, volatility and participation rate. A strategy that looks cheap on small orders may have a steep cost curve as order size grows. Compare notional and order size with available volume, not just with a fixed share count.

For larger orders, estimate market impact using buckets of order size relative to recent traded volume or displayed depth. A practical first pass is to group orders by participation bands, such as below 1%, 1% to 5%, and above 5% of volume over the execution interval.

These bands are diagnostics, not universal thresholds. Thin markets can show meaningful impact at lower participation, while deep markets may absorb more.

Use weighted statistics. Notional-weighted mean cost estimates the cost of deploying capital; median cost describes a typical order but can hide expensive tails.

Also track the 90th and 99th percentiles, rejection rate, fill rate, time to first fill, completion time and unfilled quantity. For an agent operating without supervision, the tail and failure rates can matter more than a small improvement in average cost.

For a more complete order-state test, include partial fills, cancel-replace events and rejected orders in the measurement pipeline. A paper or simulation environment should reproduce the same fields and cost definitions. A trading technology reference can help frame platform questions, but only recorded order and fill data can validate execution costs for the agent's actual instruments and trading pattern.

Use the measurement to change order behaviour

Execution quality is a strategy constraint, not a broker score in isolation. Compare alternatives on matched signals and market conditions.

For example, test marketable orders against passive orders with the same intended quantity and decision time, then include fill probability, delay, markout and the opportunity cost of non-fills. A passive strategy that saves 1 bp on filled orders can still lose if it misses a larger share of favourable moves.

Set limits that fit the strategy and instrument. A cost budget can cap expected basis points per order, maximum participation, stale-quote age or time allowed for completion. The agent should stop, reduce size or switch order policy when data quality fails or the observed spread exceeds its calibrated range. These conditions need explicit thresholds and logs so a later review can distinguish a strategy decision from a control action.

Review both aggregate and individual outliers. A sudden increase in median slippage may signal a changed market regime; one very expensive fill may point to a retry bug, a price-scale error or an order sent during a halt. Keep a per-order trace that joins the agent's input quote, intended action, API request, venue response and final account record. Platform comparisons and market infrastructure coverage can inform what to test, but they cannot replace that trace.

If this were my operation, I would first capture decision and arrival quotes, every order-state timestamp, each fill and every fee, then calculate signed cost against the arrival midpoint. I would keep spread context and post-fill markouts separate, and establish baselines by instrument, order type and size before changing routing or agent logic.

Frequently Asked Questions

How do I calculate slippage for an automated trade?

Choose and record a reference price, such as the midpoint when the order leaves the agent. For each fill, calculate the signed difference between fill price and reference price, then express it in basis points or ticks. State the benchmark because decision-time slippage also includes price movement before order arrival.

Should I add spread and slippage together?

Not if slippage is measured from the arrival midpoint to the fill price, because that measure already includes spread paid or captured. Track quoted spread as market context and add explicit fees separately. Use a different decomposition only when each component has a clearly defined, non-overlapping benchmark.

How should an agent measure commission across different markets?

Record the actual cash fee for each fill, including exchange and regulatory charges where available. Convert fees to a common basis, such as basis points of notional, when comparing instruments. Keep rebates separate so the report shows both gross fees and net fees.

What is a good slippage benchmark for a market order?

The midpoint at order arrival is a practical benchmark for measuring execution quality. The decision-time midpoint can also be useful, but it includes delay and market movement between the decision and arrival. Record both if the agent needs to distinguish those effects.

How can I measure whether passive orders are really cheaper?

Compare passive and marketable orders on matched signals, size and market conditions. Include fill rate, time to completion, unfilled quantity and post-fill markouts, not only the price improvement on completed fills. A passive order can look cheap on fills while losing opportunities through non-fills or adverse selection.