Combo Orders¶
Learning objectives
After reading this page you will understand:
- Why single-leg orders are not enough for many real trading strategies, and what leg risk means in practice
- How combo orders solve that problem by linking multiple child orders as a single atomic unit
- The real-world strategies that require combos — from simple pairs trades to three-leg statistical arbitrage — explained without jargon
- The extra complexity combos introduce: distributed state, cascade cancellation, fill-event hooks, and GTC persistence recovery
- The advanced concept of implied (synthetic) orders — quotes the exchange itself computes from existing liquidity in related books — including the mathematics behind their price and quantity calculation
What Is a Combo Order, and Why Would I Use One?¶
Imagine you are watching two tech stocks, MSFT and AAPL, and you have noticed that whenever MSFT rises faster than AAPL the gap tends to close within a few days. You want to bet on that gap closing: buy MSFT, sell AAPL, at the same moment. If you type two separate orders — one buy, one sell — the market can move between the two keystrokes. The MSFT buy fills, AAPL doesn't, and you are stuck owning something you didn't want to own alone.
That is called leg risk, and it is why combo orders exist.
A combo order bundles two or more orders into one instruction that the exchange treats as a unit:
- All legs are submitted together.
- If the market cannot fill all of them, none fill.
- If any leg is later cancelled or expires, the exchange automatically cancels all the remaining legs for you.
Three real-world situations where combos matter¶
Situation 1 — You want to trade a relationship, not a direction. You do not care whether the stock market goes up or down today. You care that MSFT is temporarily cheap relative to AAPL. A combo lets you express that view in one trade: buy MSFT, sell AAPL. You profit when the gap narrows, regardless of which way the whole market moves.
Situation 2 — You want to enter a position and hedge it at the same time. You are bullish on AAPL but worried about a broad market crash. A combo lets you buy AAPL and simultaneously sell an index (like SPY) in one atomic step. If the whole market falls, your SPY short offsets the AAPL loss.
Situation 3 — You are a professional quant with a model. Your algorithm says a particular three-stock basket is mispriced by 0.3%. You need all three legs to fill at the same time, otherwise the arbitrage disappears before you can complete the position. A three-leg combo is the only practical way to do this.
Until now every order in EduMatcher has been a single-leg order — one symbol, one side, one quantity. That is enough to teach matching, price-time priority, and basic order types. Real markets, however, are full of strategies that require multiple orders to work together as a unit. That is what combo orders are for.
What Are Combo Orders?¶
A combo order (also called a multi-leg order, spread order, or strategy order) is a single instruction that bundles two or more child orders across different symbols. The child orders are linked: they are submitted, tracked, and — critically — cancelled as a group.
The exchange decomposes this into two child limit orders and posts them to the respective order books. The parent combo tracks whether all legs have filled.
Real-world terminology
CME calls these spread orders. NASDAQ uses complex orders. Options exchanges speak of strategy orders (straddles, strangles, butterflies). The mechanics are the same: multiple legs, one intent.
Why Do Combo Orders Exist?¶
The problem with placing legs separately¶
Suppose you want to buy MSFT and simultaneously sell AAPL — a classic pairs trade. With single-leg orders you would type two commands:
NEW|SYM=MSFT|SIDE=BUY|TYPE=LIMIT|QTY=100|PRICE=415.00
NEW|SYM=AAPL|SIDE=SELL|TYPE=LIMIT|QTY=100|PRICE=210.00
Between the first and second keystroke, the market can move. Your MSFT buy might fill ("fill" = the exchange matched your order against a counterparty and the trade executed) at 415.00 but by the time your AAPL sell arrives, the price has dropped to 208.00 and your limit sits unfilled. You are now unhedged — long MSFT (you bought it and own it) with no offsetting short (a position where you profit if the price falls). Hedging means holding a second position that offsets the risk of your first; without the AAPL short, you have pure directional MSFT exposure. This is called leg risk (or execution risk).
What combos solve¶
| Single-leg problem | Combo solution |
|---|---|
| Leg risk — one side fills, the other doesn't | Both legs submitted atomically in one message |
| Manual cancellation — if one leg fails you must remember to cancel the other | Cascade-cancel: if any leg is cancelled or expires, all siblings are cancelled automatically |
| State tracking — you mentally track which orders belong together | The engine tracks the parent combo and its children as a unit |
| Strategy intent — the engine doesn't know your two orders are related | The engine understands the relationship and can report combo-level status |
New Strategies Enabled by Combos¶
Single-leg trading limits you to directional bets: buy because you think the price will rise, sell because you think it will fall. Combos unlock relative-value and volatility strategies where the profit comes from the relationship between two or more instruments, not the direction of any one.
Pairs Trading¶
Buy one stock, sell a correlated stock. You profit when the spread between them reverts to its historical mean, regardless of whether the overall market moves up or down.
Thesis: MSFT is temporarily cheap relative to AAPL. If the gap narrows — whether both rise, both fall, or MSFT rises faster — the combo profits.
Calendar (Time) Spread¶
Buy a near-dated instrument and sell a far-dated one (or vice versa). Common in futures and options. In EduMatcher this maps to two symbols representing different expiries.
Thesis: The price difference between June and September futures will widen or narrow predictably as expiry approaches.
Statistical Arbitrage¶
Trade a basket of instruments whose combined position has near-zero market exposure. Requires more legs than pairs trading.
Thesis: A quantitative model says this basket is mispriced. The combo lets you enter the entire position atomically.
Hedged Entry¶
Buy a stock and simultaneously place a protective stop on a correlated instrument to limit downside.
Thesis: You want MSFT exposure but hedge broad market risk by shorting the index.
Market-Making Spread¶
A market maker is a participant whose job is to continuously post both a buy order (bid) and a sell order (ask) on the book, providing liquidity so that other traders can execute immediately. The market maker profits from the small price gap between their bid and ask (the "bid-ask spread"), but takes on inventory risk.
With combos, a market maker can quote both sides of two related symbols simultaneously, capturing the bid-ask spread on both while maintaining a hedged book.
Complexity Introduced by Combos¶
Combos look simple on the surface — "just submit two orders together." Under the hood they introduce significant new complexity that single-leg orders never had to deal with.
Distributed State¶
A single-leg order lives in one order book. A combo spans multiple books. The engine must track a parent object (the combo) and its children (the legs) across separate data structures. Every fill, cancel, or expiry on any child must propagate back to the parent.
Lifecycle Management¶
Single-leg orders have a simple lifecycle: NEW → PARTIAL → FILLED (or CANCELLED / EXPIRED). Combos add a second layer:
stateDiagram-v2
[*] --> PENDING : legs accepted
PENDING --> PARTIALLY_MATCHED : first leg fill
PARTIALLY_MATCHED --> MATCHED : all legs fully filled
PENDING --> FAILED : a leg cancelled or expired
PARTIALLY_MATCHED --> FAILED : a leg cancelled or expired
PENDING --> CANCELLED : explicit CANCEL|COMBO_ID=
PARTIALLY_MATCHED --> CANCELLED : explicit CANCEL|COMBO_ID=
FAILED --> [*] : cascade-cancel remaining legs
CANCELLED --> [*]
MATCHED --> [*]
The engine must detect transitions at the combo level whenever a child-level event occurs.
Cascade Cancellation¶
If one leg of a combo is cancelled or expires, the remaining legs must be automatically cancelled. This is non-trivial:
- The cancelled leg might be on a different book than its siblings.
- A sibling might be partially filled — do you cancel only the unfilled remainder, or reject the entire combo?
- A sibling might fill in the same engine cycle that the first leg is cancelled — a race between fill and cancel.
EduMatcher handles this by marking the combo as FAILED and cancelling all siblings' unfilled quantities. Fills that already occurred are not unwound.
No trade unwinds
Once a trade is executed, it is final. A combo failure does not reverse fills that already happened on other legs. This mirrors real exchange behavior — trades are irrevocable.
Fill Event Hooks¶
In a single-leg system the engine processes an order and publishes fills. With combos, every fill on a resting child order must also trigger a parent combo check: "Is this combo now fully matched?" This requires a reverse lookup from child order ID to parent combo ID on every fill event.
Persistence Recovery¶
GTC combos must survive engine restarts. On shutdown the engine persists both the parent combo metadata and its child orders. On startup it must reconstruct the parent-child links and resume tracking fill progress — a non-trivial deserialization problem.
Visibility and Information Leakage¶
Should combo child orders be visible on the per-symbol book? If yes, counterparties can see "someone is building a pairs position" and front-run the trade (rush to trade ahead of them, anticipating the price impact of the remaining legs). If no, the book underrepresents true liquidity. EduMatcher shows child orders on the book (they are normal resting orders) but does not label them as combo legs.
Trading Combos in EduMatcher¶
Submitting a Combo¶
From the gateway terminal, use the TYPE=COMBO format:
NEW|TYPE=COMBO|COMBO_ID=PAIR-001|COMBO_TYPE=AON|TIF=GTC|LEG_COUNT=2|LEG0.SYM=MSFT|LEG0.SIDE=BUY|LEG0.QTY=100|LEG0.PRICE=415.00|LEG1.SYM=AAPL|LEG1.SIDE=SELL|LEG1.QTY=100|LEG1.PRICE=210.00
| Field | Meaning |
|---|---|
TYPE=COMBO |
Tells the parser this is a multi-leg order |
COMBO_ID=PAIR-001 |
Your tracking label (human-readable) |
COMBO_TYPE=AON |
All-or-none semantics: combo completes only when all legs are fully filled |
TIF=GTC |
Time-in-force applied to all legs |
LEG_COUNT=2 |
Number of legs (2–10) |
LEG<i>.SYM |
Symbol for leg i |
LEG<i>.SIDE |
BUY or SELL for leg i |
LEG<i>.QTY |
Quantity for leg i |
LEG<i>.PRICE |
Limit price for leg i |
What Happens After Submission¶
- The engine validates the combo (symbols allowed, no duplicates, valid quantities).
- If valid, the engine sends a combo ACK back to your gateway.
- The engine creates child orders — one per leg — and posts them to the respective order books.
- Child orders match and rest like normal orders. Each fill is reported to you as a
standard
order.fillevent. - When all legs are fully filled, the engine publishes a
combo.fill(MATCHED)event. - If any leg is cancelled or expires before all legs fill, the engine
cascade-cancels the remaining legs and publishes
combo.fill(FAILED).
Cancelling a Combo¶
This cancels all child legs atomically. Fills that already occurred are not reversed.
Monitoring Combo Status¶
The ORDERS command shows child orders with their parent combo ID. The pm-orders
monitor displays combo-level status transitions in real time.
New Demands on Market Makers¶
Single-leg market makers quote bid and ask on one symbol. Combos create demand for cross-symbol liquidity — someone must be willing to take the other side of both legs simultaneously.
Why Single-Leg MM Is Not Enough¶
A pairs trader submits COMBO [BUY MSFT, SELL AAPL]. The MSFT leg rests on the MSFT
book and the AAPL leg rests on the AAPL book. A single-symbol market maker on MSFT
might fill the MSFT leg, but nobody fills the AAPL leg. The combo sits
partially matched, exposed to leg risk, until eventually the AAPL leg fills or expires.
What Combo-Aware Market Makers Provide¶
A market maker that understands combos can:
- Seed both sides of common pairs at startup, ensuring combos find immediate liquidity.
- Quote spreads rather than individual symbols, tightening the effective cost of entering a combo position.
- Rebalance dynamically — when one leg fills, adjust quotes on the other leg to maintain a hedged book.
Configuration¶
In engine_config.yaml, market-maker startup quote seeds can be combined with combo seeds:
symbols:
MSFT:
market_maker_quotes:
- gateway_id: MM01
bid_price: 414.00
ask_price: 416.00
bid_qty: 100
ask_qty: 100
AAPL:
market_maker_quotes:
- gateway_id: MM01
bid_price: 209.00
ask_price: 211.00
bid_qty: 100
ask_qty: 100
market_maker_combos:
- combo_id: MM-MSFT-AAPL
combo_type: AON
tif: GTC
legs:
- symbol: MSFT
side: BUY
order_type: LIMIT
quantity: 100
price: 414.50
- symbol: AAPL
side: SELL
order_type: LIMIT
quantity: 100
price: 210.50
This ensures that when a retail trader submits a combo, there is resting liquidity on both legs from day one.
Example Strategies in Detail¶
Example 1 — Pairs Trade: MSFT vs AAPL¶
Setup: You believe MSFT is undervalued relative to AAPL. The historical price ratio is 2.0 (MSFT ≈ 2× AAPL), but today MSFT is trading at 415 and AAPL at 212 — a ratio of 1.96. You expect reversion.
Combo:
NEW|TYPE=COMBO|COMBO_ID=PAIR-REVERT|COMBO_TYPE=AON|TIF=GTC|LEG_COUNT=2|LEG0.SYM=MSFT|LEG0.SIDE=BUY|LEG0.QTY=100|LEG0.PRICE=415.00|LEG1.SYM=AAPL|LEG1.SIDE=SELL|LEG1.QTY=100|LEG1.PRICE=212.00
Outcome if ratio reverts to 2.0:
P&L convention: for your long MSFT position, profit = (exit price − entry price) × quantity. For your short AAPL position, profit = (entry price − exit price) × quantity (you profit when the price falls below where you sold).
| Scenario | MSFT | AAPL | P&L |
|---|---|---|---|
| Both rise | 420 (+5) | 210 (+2) | +500 + 200 = +700 |
| Both fall | 410 (−5) | 205 (+7) | −500 + 700 = +200 |
| MSFT rises, AAPL flat | 420 (+5) | 212 (0) | +500 + 0 = +500 |
The combo profits regardless of market direction — only the spread matters.
Example 2 — Hedged Long¶
Setup: You are bullish on AAPL but worried about a broad market sell-off.
Combo:
NEW|TYPE=COMBO|COMBO_ID=HEDGE-LONG|COMBO_TYPE=AON|TIF=DAY|LEG_COUNT=2|LEG0.SYM=AAPL|LEG0.SIDE=BUY|LEG0.QTY=200|LEG0.PRICE=210.00|LEG1.SYM=SPY|LEG1.SIDE=SELL|LEG1.QTY=100|LEG1.PRICE=520.00
If the market crashes, your SPY short offsets losses on AAPL. If AAPL outperforms the index, you profit on the spread.
Example 3 — Calendar Spread¶
Setup: You expect the June/September ES futures spread to narrow.
Combo:
NEW|TYPE=COMBO|COMBO_ID=CAL-ES|COMBO_TYPE=AON|TIF=GTC|LEG_COUNT=2|LEG0.SYM=ESM26|LEG0.SIDE=BUY|LEG0.QTY=50|LEG0.PRICE=5200.00|LEG1.SYM=ESU26|LEG1.SIDE=SELL|LEG1.QTY=50|LEG1.PRICE=5220.00
You enter at a spread of 20 points. If the spread narrows to 10, you close both legs and pocket 10 × 50 = 500 points profit.
Example 4 — Three-Leg Statistical Arbitrage¶
Setup: A quant model identifies a mispricing in the AAPL/MSFT/GOOG triangle.
Combo:
NEW|TYPE=COMBO|COMBO_ID=STAT-ARB|COMBO_TYPE=AON|TIF=GTC|LEG_COUNT=3|LEG0.SYM=AAPL|LEG0.SIDE=BUY|LEG0.QTY=200|LEG0.PRICE=210.00|LEG1.SYM=MSFT|LEG1.SIDE=SELL|LEG1.QTY=100|LEG1.PRICE=415.00|LEG2.SYM=GOOG|LEG2.SIDE=SELL|LEG2.QTY=50|LEG2.PRICE=170.00
The combo ensures all three legs enter simultaneously. Without a combo, the arbitrageur risks partial execution and model-breaking slippage.
Example 5 — Market-Maker Spread Seeding¶
Setup: A market maker wants to provide liquidity for MSFT/AAPL pairs traders.
Combo (bid side of spread):
NEW|TYPE=COMBO|COMBO_ID=MM-BID|COMBO_TYPE=AON|TIF=GTC|LEG_COUNT=2|LEG0.SYM=MSFT|LEG0.SIDE=BUY|LEG0.QTY=100|LEG0.PRICE=414.50|LEG1.SYM=AAPL|LEG1.SIDE=SELL|LEG1.QTY=100|LEG1.PRICE=210.50
Combo (ask side of spread):
NEW|TYPE=COMBO|COMBO_ID=MM-ASK|COMBO_TYPE=AON|TIF=GTC|LEG_COUNT=2|LEG0.SYM=MSFT|LEG0.SIDE=SELL|LEG0.QTY=100|LEG0.PRICE=415.50|LEG1.SYM=AAPL|LEG1.SIDE=BUY|LEG1.QTY=100|LEG1.PRICE=209.50
The market maker earns the spread between bid and ask on both legs — but must manage the risk that one leg fills before the other.
Summary¶
| Aspect | Single-Leg Orders | Combo Orders |
|---|---|---|
| Scope | One symbol | 2–10 symbols |
| Leg risk | N/A | Managed by cascade-cancel |
| Strategies | Directional (long/short) | Relative-value, hedged, arbitrage |
| State tracking | One book, one lifecycle | Parent combo + children across books |
| Cancellation | Cancel one order | Cancel cascades to all siblings |
| Market-maker demands | Quote one symbol | Quote cross-symbol spreads |
| Persistence | One order per file entry | Combo metadata + child orders |
| Complexity | Low | Significantly higher |
Combos are where an educational trading system transitions from "toy" to "architecturally realistic." They force you to think about distributed state, failure cascades, and the tension between atomicity and performance — the same problems real exchanges spend years solving.
Implied Orders (Synthetic Orders)¶
This section explains an advanced but very important exchange concept: implied orders (also called synthetic orders).
However, this concept is not yet supported by EduMatcher
The key idea in one paragraph¶
Some exchanges maintain a spread book — a separate order book whose "instrument" is not a single stock but a price difference between two (or more) stocks. For example, a spread book for "MSFT minus AAPL" lets traders buy or sell the numerical difference between MSFT and AAPL prices as if it were its own tradeable product. Concretely, "buying the spread at 205" means you end up long MSFT and short AAPL at a net cost of 205 per share — regardless of whether MSFT is at 415 and AAPL at 210, or MSFT at 420 and AAPL at 215. You are trading the gap, not the individual prices.
Now imagine that spread book is empty — nobody has directly placed an order in it. Yet on the outright MSFT book (the ordinary, single-symbol order book where people trade just MSFT) there is a resting bid at 415.00 (meaning someone is willing to buy MSFT at that price), and on the outright AAPL book there is a resting ask at 210.10 (someone is willing to sell AAPL at that price).
Here is the key insight: any trader who wants to sell the spread (= sell MSFT and buy AAPL) could execute against those two existing orders right now — sell MSFT at 415.00 (hitting that bid) and buy AAPL at 210.10 (hitting that ask) — netting 415.00 − 210.10 = 204.90. The exchange recognizes this and automatically publishes a synthetic bid of 204.90 in the spread book. That synthetic quote is an implied order — executable liquidity that exists but was never typed by any human.
Major derivatives exchanges (CME Globex, Eurex T7, ICE) rely heavily on implied order engines to connect fragmented books and improve fill rates.
If you are new to markets, read this as:
- A direct order is something a trader explicitly entered.
- An implied/synthetic order is extra liquidity the exchange computes from other available orders.
First: beginner terminology¶
- Liquidity: how much you can trade without waiting. More resting orders means more liquidity.
- Bid: highest price someone is willing to buy at.
- Ask: lowest price someone is willing to sell at.
- Bid-ask spread: the gap between the best ask and best bid in a single book (for example, if MSFT best bid is 415.00 and best ask is 415.20, the bid-ask spread is 0.20).
- Spread instrument: a synthetic product defined as the price difference between two or more symbols (for example, "MSFT minus AAPL"). Not the same as bid-ask spread — this is a tradeable product in its own right.
- Resting order: an order that has been posted to the book but not yet matched. It sits there passively, waiting for someone to trade against it.
- Hitting: executing against a resting order. "Hit the bid" means you sell to the person whose buy order is resting at the bid price. "Hit the ask" (also called "lifting the offer") means you buy from the person whose sell order is resting at the ask price.
- Leg: one component of a combo. A 2-leg combo has two child orders.
- Outright: a normal single-symbol market (for example, just MSFT).
- Synthetic instrument: a derived instrument built from other instruments (for example, spread = MSFT - AAPL).
- Implied order: a quoted buy/sell order in one book that is inferred from prices resting in related books.
- Atomic execution: all required legs execute together as one transaction, or none execute.
Why combo markets are hard without implied orders¶
Combo markets have structural problems:
-
Fragmented liquidity: Liquidity exists in many places (outright books, other combo books), so one combo book can look empty even when executable prices exist elsewhere.
-
Leg risk: If a strategy is filled leg-by-leg manually, one leg can fill while others do not. The trader is left with unwanted directional exposure.
-
Wide displayed spreads: Without implied quotes, visible combo bid/ask can be sparse and wide, discouraging participation.
-
Price inconsistency: The same economic position can be priced differently across related markets, creating temporary dislocations.
What problem implied orders solve¶
Implied orders solve a visibility and matching problem:
- They expose executable combo liquidity that already exists indirectly in related books.
- They tighten quoted spreads in combo books.
- They increase fill probability for strategy traders.
- They align related market prices more quickly.
Important: implied orders do not create "free money". They reveal and route existing executable relationships between books.
How implied orders accomplish this¶
At a high level, the exchange continuously does this:
- Watch all relevant books (outrights and related combos).
- Build candidate synthetic prices using valid price relationships.
- Compute the maximum executable synthetic quantity from limiting legs.
- Publish implied bid/ask levels in the target book.
- Recompute immediately whenever any source book changes.
When a trader hits an implied quote, the exchange does not simply report a theoretical price — it actually executes the underlying leg trades. For example, if a trader sells the MSFT-AAPL spread at the implied bid of 204.90, the exchange simultaneously:
- Sells MSFT at 415.00 against the resting bid in the MSFT book.
- Buys AAPL at 210.10 against the resting ask in the AAPL book.
- Reports all fills to the respective parties.
This happens atomically — either both legs execute, or neither does. The original resting orders in the outright books are consumed (partially or fully), just as if someone had traded against them directly.
Detailed calculation model (2-leg spread)¶
Assume a spread instrument:
where:
- \(A\) is leg 1 (for example MSFT)
- \(B\) is leg 2 (for example AAPL)
- \(S\) is the synthetic spread market
Let:
- \(A_{bid}\) = best bid price in A
- \(A_{ask}\) = best ask price in A
- \(B_{bid}\) = best bid price in B
- \(B_{ask}\) = best ask price in B
Implied bid for spread \(S\)¶
The implied bid represents resting synthetic buy interest — the price a spread seller can receive by executing against existing outright liquidity.
To sell \(S = A - B\), the seller:
- sells \(A\) (hits the resting bid → receives \(A_{bid}\)), and
- buys \(B\) (hits the resting ask → pays \(B_{ask}\))
Net price received (= implied bid):
Implied ask for spread \(S\)¶
The implied ask represents resting synthetic sell interest — the price a spread buyer must pay to execute against existing outright liquidity.
To buy \(S = A - B\), the buyer:
- buys \(A\) (hits the resting ask → pays \(A_{ask}\)), and
- sells \(B\) (hits the resting bid → receives \(B_{bid}\))
Net price paid (= implied ask):
Implied quantity¶
Implied size is constrained by the smallest executable leg quantity after ratio normalization.
For 1:1 ratio spreads:
For general ratios \(r_A : r_B\):
Generalized weighted synthetic pricing¶
For a multi-leg synthetic:
where:
- \(w_i\) are signed leg weights (positive for bought legs, negative for sold legs)
- \(P_i\) are the price used for leg \(i\), selected according to the side-selection rule below
Side-selection rule: the key question is "which price (bid or ask) do I use for each leg?" The answer depends on who is executing and which direction they trade each leg:
| Computing... | For legs you BUY | For legs you SELL |
|---|---|---|
| Synthetic bid (what a seller receives) | Use the ask (seller must buy this leg, hitting the ask) | Use the bid (seller sells this leg, hitting the bid) |
| Synthetic ask (what a buyer pays) | Use the ask (buyer buys this leg, hitting the ask) | Use the bid (buyer sells this leg, hitting the bid) |
Simplified: always use the price that the taker would actually receive or pay — the bid when selling into it, the ask when buying into it. This ensures the synthetic price reflects real executable costs, not theoretical mid-prices.
Worked Example 1 (2-leg, equal ratios)¶
Goal: build implied quotes for spread \(S = MSFT - AAPL\) (1:1).
Assume current books:
- MSFT best bid = 415.00 (qty 120)
- MSFT best ask = 415.20 (qty 80)
- AAPL best bid = 210.00 (qty 90)
- AAPL best ask = 210.10 (qty 200)
Implied spread bid:
Implied spread ask:
Implied bid quantity (1:1, using MSFT bid qty and AAPL ask qty):
Implied ask quantity (1:1, using MSFT ask qty and AAPL bid qty):
So the spread book can display synthetic liquidity:
- Bid 204.90 x 120
- Ask 205.20 x 80
Even if no trader directly entered spread orders.
Worked Example 2 (3-leg with ratios)¶
Synthetic instrument:
Interpretation per 1 unit of \(X\):
- Buy 2 of A
- Sell 1 of B
- Sell 3 of C
Assume top-of-book:
- A bid/ask: 100.00 / 100.20, qty at ask = 250, qty at bid = 180
- B bid/ask: 40.10 / 40.30, qty at bid = 140, qty at ask = 300
- C bid/ask: 10.00 / 10.05, qty at bid = 500, qty at ask = 220
Synthetic bid for X¶
The implied bid is what a seller of X receives. Selling X means reversing the definition: sell A, buy B, buy C.
- sell A at \(A_{bid}\) = 100.00 (qty available: 180)
- buy B at \(B_{ask}\) = 40.30 (qty available: 300)
- buy C at \(C_{ask}\) = 10.05 (qty available: 220)
Price:
Quantity limits by ratio:
- A supports \(\lfloor 180/2 \rfloor = 90\) synthetic units
- B supports \(\lfloor 300/1 \rfloor = 300\) synthetic units
- C supports \(\lfloor 220/3 \rfloor = 73\) synthetic units
So:
Synthetic ask for X¶
The implied ask is what a buyer of X pays. Buying X means executing the definition directly: buy A, sell B, sell C.
- buy A at \(A_{ask}\) = 100.20 (qty available: 250)
- sell B at \(B_{bid}\) = 40.10 (qty available: 140)
- sell C at \(C_{bid}\) = 10.00 (qty available: 500)
Price:
Quantity limits:
- A supports \(\lfloor 250/2 \rfloor = 125\)
- B supports \(\lfloor 140/1 \rfloor = 140\)
- C supports \(\lfloor 500/3 \rfloor = 166\)
So:
This yields implied quotes for X:
- Bid 129.55 x 73
- Ask 130.30 x 125
The implied spread is 0.75, representing normal market conditions. With different input prices, implied markets can cross (bid ≥ ask), indicating an arbitrage that production engines immediately consume via matching.
Directions of implication¶
The examples above demonstrate implied-in: outright book liquidity is combined to generate synthetic quotes in a combo/spread book. Production exchanges support additional implication directions:
| Direction | Source → Target | Example |
|---|---|---|
| Implied-in | Outrights → Spread | MSFT bid + AAPL ask → MSFT-AAPL spread bid |
| Implied-out | Spread → Outrights | A resting spread order implies an outright quote in one leg, given liquidity in the other |
| Implied-through | Spread → Spread | Liquidity in spread AB and outright B together imply a quote in spread AC |
Implied-out example: A trader posts "sell MSFT-AAPL spread at 205.00." If AAPL has a resting bid at 210.00, the exchange can derive an implied offer in MSFT at 415.00 (= 205.00 + 210.00). This publishes synthetic sell liquidity in the outright MSFT book that did not previously exist.
Implied-through chains multiple relationships: spread AB liquidity combined with outright B liquidity generates implied quotes in spread AC. The combinatorial explosion of paths is the primary reason implied engines are computationally expensive.
Most exchange implied engines support implied-in and implied-out. Only the most sophisticated (CME Globex, Eurex T7) additionally support implied-through, often limited to a configurable hop depth to bound computation.
Practical implementation challenges¶
Building implied orders correctly in a matching engine is hard. Common issues:
-
Atomic routing: Implied fills must map to real leg executions in one atomic transaction.
-
Double counting: The same leg liquidity can be reachable through multiple synthetic paths. Engines must prevent over-committing that liquidity.
-
Priority policy: Venues define whether direct orders outrank implied orders at same price/time.
-
Performance: Every book update can trigger recomputation across many related instruments.
-
Consistency under concurrency: Between quote calculation and execution, source books can change. Matching must lock/sequence state safely.
-
Explainability: Traders and surveillance systems need audit trails showing which source liquidity created each implied fill.
How this relates to EduMatcher today¶
Current EduMatcher combo handling is parent/child leg tracking over outright books. It does not yet implement a native synthetic instrument book with implied quote generation. This section describes the exchange-grade mechanism typically added in a later architectural step.
See also¶
- Order Types — the individual order types used as combo legs
- Auctions & Scheduling — how combos interact with auction phases
- Persistence — how GTC combos are saved and restored across sessions
- Messages —
combo.ack,order.fill, and cascade-cancel events - Gateway — the full COMBO and CANCEL|COMBO_ID= command syntax