Order execution replay methodology

Reproduce five worked examples from one simulated spot market. Version 1.0 contains the opening book, the modeled orders, the stop-event sequence and the expected outputs.

Order execution learning path

Download the JSON inputs and results or the CSV inputs.

Provenance and units

Token Trade Book created the prices, quantities and event order for teaching. No public market data, private account logs or actual orders were used. Prices are USD per base unit, sizes are base units, and fees are USD.

Cite or reuse this replay

You may reuse the example data with attribution and a link to this page. Keep the simulated-data label when reproducing the figures or the file.

Suggested credit: Token Trade Book, Order execution replay methodology, version 1.0 (simulated data).

Reproduce the book and spread

Five displayed price levels
SidePriceUnits
Ask$102.004
Ask$101.502
Ask$100.001
Bid$99.502
Bid$99.003

Take the highest bid and lowest ask. Subtract the bid from the ask for the $0.50 spread. Average the two quotes for the $99.75 midpoint.

Reproduce the market buy

Modeled market-buy fills
UnitsPriceValue
1$100.00$100.00
2$101.50$203.00
Total$303.00

Take size from the lowest ask first, then the next ask until the request is filled. Divide total fill value by filled size. Compare the resulting average to the opening best ask. The expected result is $101.00 per unit and 1.00% adverse before fees.

Replay the mixed-fee order

Restart from the same opening book. Submit a three-unit buy limit at $101.00. Only the first ask is at or below that price. Fill one unit there and rest two at the submitted limit. Model a later sell that takes those two units. Multiply each fill value by its role’s fee rate. Later execution is an input to the exercise. The modeled fees add to $0.402 before rounding.

Modeled per-fill fees
RoleUnitsPriceFee
Taker1$100.00$0.200
Maker2$101.00$0.202
Total fees$0.402

Replay the sell stop-limit

Use a separate falling-price path, last trade as the trigger feed and good till canceled as the order instruction. The ordered events determine the result. The trigger event and the best bid available when the limit is submitted are separate inputs.

  1. WaitingThe last trade is $96.00. The sell stop is inactive.
  2. TriggeredThe last trade reaches $95.00. A sell limit opens at $94.00. In this replay it is good till canceled.
  3. No fillThe best available bid on submission is $93.00, below the sell limit. 1 unit remains open at the end of this replay.

What the model leaves out

Actual outcomes depend on venue rules, timing and available liquidity. The market-buy and mixed-fee examples hold the opening book fixed until the stated event. They omit queue position, hidden orders, cancellations, latency, protections, tick and lot rounding, fee tiers and fee-asset conversion. The modeled stop case ends after submission. No later execution is assumed.