Direct Answer

An OMS state consistency checker inspects a sequence of order events for state-machine bugs, illegal state transitions, overfills, negative open quantity, fills on terminal orders, and quantity arithmetic errors. Enter an order event sequence and the tool flags each inconsistency it detects, using only user-entered data. These bugs are a common source of silent position-tracking errors in order management systems.

Tool

Enter order events in sequence. Each event describes what happened to the order at that step.

Event Type Fill Qty (shares) Fill Price ($) Reported State
1
2
3
4
5
6
7
8

Uses user-entered data only. No data is transmitted or stored.

How to use this tool

Enter the total order quantity and side (Buy, Sell, or Sell Short). Then enter the sequence of events that occurred for this order, in chronological order. For each event, select the event type and, for fill events (PARTIAL_FILL, FILL, BUST), enter the fill quantity and price. Optionally, set the "Reported State" to what your OMS reported at that step; the tool will flag discrepancies between the expected state from the state machine and the state your OMS reported.

Click "Check Consistency" to run the state machine simulator. The tool traces the order through each event, applies the canonical state transition rules, accumulates fill quantity and average price, and checks for any violations.

The default example shows a clean 10,000-share buy order with three fills (3,000 + 4,000 + 3,000 = 10,000 shares) that all resolve correctly. Try adding a FILL event after the order is already Filled (event 7), or entering a fill quantity that makes the total exceed the order quantity, to see what errors are detected.

Understanding the outputs

The tool checks for four categories of errors:

  • Illegal state transition: A state change that the canonical OMS state machine does not permit. For example, going from Filled back to Open, or from Rejected to PartiallyFilled. These represent OMS state machine bugs or corrupted event log replays.
  • Overfill: Cumulative fill quantity exceeds the original order quantity. The OMS must reject fills that would cause this and alert the operations team immediately, an overfilled order creates a position larger than was intended and consumes more capital than allocated.
  • Fill on terminal order: A fill event arrived for an order that was already in a terminal state (Filled, Cancelled, or Rejected). The OMS must not apply fills to terminal orders. This can happen when a BUST (trade cancellation) is processed after which the exchange sends a fill for the same order.
  • State mismatch: The "Reported State" you entered for a step differs from the state the canonical state machine expects at that point. This can reveal OMS implementation errors where the order state field is updated incorrectly relative to what the event should produce.

Warnings are generated for events that are valid but unusual, for example, a CANCEL_ACK on a Partially Filled order (the order is partially executed and the remainder is cancelled).

A woman pointing at a laptop screen showing a state comparison chart at a business desk.
Photo by Kampus Production via Pexels

Assumptions and limitations

  • This tool models a simplified single-leg order state machine for standard equity orders. It does not model multi-leg strategies, options exercise, or partial cancel/replace (cancel-and-replace is modeled as CANCEL_ACK followed by a new order sequence).
  • The BUST event is modeled as applying a negative fill quantity equal to the fill quantity entered, reducing the cumulative fill total. In a real OMS, busts may be applied at the child or parent level; this tool models the order level only.
  • Average price is computed as a running weighted average: new_avg = (old_avg × old_qty + fill_price × fill_qty) / (old_qty + fill_qty). For bust events, the average price is updated to reflect the removal of the busted fill's contribution.
  • The tool does not check commission correctness, allocation proportionality, settlement date consistency, or multi-account scenarios. For position-level effects, see the Order, Fill, and Position State Models guide.

Frequently Asked Questions

What is the canonical OMS state machine?

The canonical state machine for equity order lifecycle defines the states an order can be in and which transitions are legal. Valid states: New (order created in OMS, not yet sent), PendingNew (sent to broker, acknowledgement awaited), Open (acknowledged, resting at exchange), PartiallyFilled (one or more fills received, remainder open), Filled (all shares executed), Cancelled (order cancelled with open quantity remaining), Rejected (broker or exchange rejected the order). Legal transitions are one-directional: you cannot go from Filled back to Open, or from Cancelled to PartiallyFilled. See the full state model guide for the transition table and FIX OrdStatus tag mappings.

What causes an overfill in practice?

Overfills occur when the OMS fails to enforce a fill quantity ceiling equal to the order's original total quantity. Common causes: a race condition where two fill events arrive simultaneously and both pass the quantity check before either updates the cumulative fill counter; incorrect handling of amended orders where the quantity was reduced but fills were still processed against the original quantity; or a missing quantity check in the fill processing path. Overfills must be caught in real time, any fill that would cause cumulative fill quantity to exceed the order quantity should be rejected by the OMS and flagged immediately.

What does a BUST event do to the state machine?

A bust (FIX ExecType='H', Trade Cancel) reverses a fill. In the OMS, it should apply a correcting entry with negative fill quantity equal to the original fill quantity being busted. This reduces the cumulative fill total. If the order was fully Filled before the bust, the bust returns it to PartiallyFilled or Open state depending on how much is now unfilled. The OMS must also update the open quantity (order quantity minus remaining cumulative fill quantity) and recompute the average price to reflect the removal of the busted fill's contribution. See the Corrections, Busts, and Trade Amendments guide.

What is "fill on terminal order" and why is it dangerous?

A fill event is received for an order that is already in a terminal state, Filled, Cancelled, or Rejected. The OMS must not apply this fill because the order has no remaining open quantity to fill. If the OMS incorrectly processes the fill, the position count increases beyond what was intended (or decreases for a sell), the average price is corrupted, and the result may be an unintended long or short position. In practice this can happen when a CANCEL_ACK and a FILL cross in flight from the exchange, the OMS receives both and must determine which arrived first. The canonical resolution is to honor the fill if it predates the cancel at the exchange, or reject it if the exchange acknowledged the cancel before sending the fill.

Can I test error scenarios with this tool?

Yes. Try adding a FILL event in row 7 after row 6 completes the order (Fill state), the tool will flag "fill on terminal order." Or increase the fill quantity in row 6 to 4,000 instead of 3,000, total fills will be 11,000 against a 10,000-share order, triggering an overfill error. Or select "Cancelled" as the Reported State in row 4, the tool will flag a state mismatch because after a PARTIAL_FILL the expected state is PartiallyFilled, not Cancelled.

What event sequence format does the checker expect?

An ordered list of order lifecycle events, each naming the event type and carrying the quantities associated with it, in the order the system processed them. The order matters: the tool evaluates each event against the state produced by the ones before it, so a sequence sorted by venue timestamp rather than by processing order will produce different findings. Feeding both orderings through separately is a way to see whether a suspected bug is a logic error or an ordering problem.

Does a clean result mean the order handling logic is correct?

It means the specific sequence entered contains none of the inconsistencies the tool looks for. The checks cover transition legality, quantity arithmetic, overfills, and activity on terminal orders. They cannot evaluate whether the state model itself matches the venue, whether the sequence is representative of what production sees, or whether events are being dropped before they reach the handler. The strongest use is running known-bad sequences to confirm the checks fire, then real captured sequences.

How can a real production event sequence be captured for this?

From the order log, provided it records every state-changing event rather than only the final outcome. The fields needed are the event type and the quantities, which most structured order logs already carry. Where a log records only order snapshots at intervals, the sequence has to be reconstructed and the reconstruction may itself hide the transition that caused the problem. That gap is often the first useful finding from attempting the exercise.

How should a flagged inconsistency be triaged?

By separating whether the event stream was wrong or the handler was. An overfill can mean the venue genuinely sent more executed quantity than was ordered, which is a counterparty question, or that duplicate fill events were applied twice, which is a handler question. Comparing the flagged sequence against the raw messages received, before changing any code, identifies which of the two applies and prevents a fix that suppresses the symptom while leaving the cause.

References

Disclaimer

This tool is for educational purposes only. It models a simplified order state machine and does not replicate any specific OMS vendor's implementation. Results are illustrative and should not be used as a substitute for formal OMS testing in a controlled environment. Uses user-entered data only, no data is transmitted or stored.