Arbitrage is exposed between the legs

0
22

XCore HFT / Trading Lab

Arbitrage is exposed between the legs

Quantitative execution, market-microstructure, and risk-control research from XTRSK.

What this problem really is

Arbitrage that appears “market‑neutral” on paper is often a fragile construct that exists only after both legs of the spread have been executed. In practice the two orders travel through distinct limit‑order books, each with its own queue dynamics, minimum lot sizes and latency profile. Until the final fill of the second leg the trader carries a directional exposure that can be amplified by adverse price moves, liquidity droughts or partial execution. The interval between the first and last fill therefore contains both a pure market‑direction risk – the price may move against the unfilled side – and a liquidity risk – the remaining quantity may never be matched at the intended price. Recognising that the spread is not truly neutral until the moment of completion is the first step to managing the hidden risk that turns a textbook arbitrage into a realised position at an unfavourable price.

Arbitrage is exposed between the legs: mechanism
Figure 1. How the components of this idea connect

How the mechanism works, step by step

When a trader initiates a two‑leg arbitrage, the execution engine creates a pair of child orders, each tagged with a unique identifier and a target quantity. After every market event – a fill, a cancellation, a queue‑position change – the engine updates two counters: the cumulative filled quantity and the residual quantity that still needs to be executed. These counters are the only reliable source of truth for the spread’s status; they replace any assumption that the order book will remain static.

A hedge threshold is defined as the maximum acceptable deviation between the realised price of the filled leg and the expected price of the pending leg. If the market moves such that the projected P&L of the remaining leg falls below this threshold, the system must either cancel the outstanding order or reroute it to an alternative venue where the spread is still viable. The cancel threshold is a hard stop: once the projected loss exceeds a pre‑set limit, the order is withdrawn to prevent further exposure. The reroute threshold sits slightly tighter; it triggers a re‑submission to a different venue before the cancel limit is reached, preserving the chance of completing the spread without taking a loss.

Partial fills are modelled explicitly. Each venue imposes a minimum executable size – for example, 100 contracts on Exchange X and 250 contracts on Exchange Y. The engine therefore splits the total target into sub‑orders that respect these minima, and it records the exact fill size returned by the exchange. If a sub‑order receives a partial fill, the residual is automatically re‑queued, but the residual quantity is also re‑evaluated against the hedge and cancel thresholds. Completion‑time distributions are built from historic latency and fill‑rate data for each venue; they give a probabilistic estimate of how long the second leg will remain open. This distribution is used in real time to decide whether the expected waiting cost outweighs the spread capture.

A worked example with real numbers

Consider a trader who spots a 10‑tick spread between two electronic venues on the same underlying future. The buy side is on Venue A, where the best ask is 100.00 £ and the minimum order size is 200 contracts. The sell side is on Venue B, where the best bid is 100.10 £ with a minimum size of 250 contracts. The trader decides to execute a notional of 1 000 contracts, creating a buy order of 1 000 on A and a sell order of 1 000 on B.

The first fill arrives from Venue A after 12 ms: 1 000 contracts are bought at 100.00 £, so the filled‑quantity counter for the buy leg reaches 1 000 and the residual for the sell leg remains 1 000. The hedge threshold is set at a 5‑tick adverse move; the cancel threshold at 8 ticks. Within the next 30 ms the price on Venue B drops to 100.05 £, eroding the spread to 5 ticks. The engine projects that, if the remaining 1 000 contracts are sold at the current best bid, the realised P&L would be 5 ticks × 1 000 = 5 000 £, still above the hedge limit.

A partial fill then arrives from Venue B: 600 contracts are sold at 100.10 £, leaving 400 contracts unfilled. The filled‑quantity counter for the sell leg updates to 600, the residual becomes 400, and the system recomputes the projected P&L. The price on Venue B continues to drift down to 100.02 £, while Venue A’s price remains at 100.00 £. If the remaining 400 contracts were sold now, the spread would be only 2 ticks, delivering a P&L of 800 £, well below the hedge threshold. The engine therefore triggers the cancel threshold for the residual sell order. The outstanding 400 contracts are cancelled, and a new sell order of 400 contracts is immediately rerouted to Venue C, where the best bid is 100.08 £ and the minimum size is 100 contracts.

The reroute succeeds after 18 ms, filling the 400 contracts at 100.08 £. The total realised P&L is (100.10 £ × 600 + 100.08 £ × 400) − (100.00 £ × 1 000) = (60 060 + 40 032) − 100 000 = 92 £, equivalent to 9.2 ticks. The trader has successfully captured most of the spread, but only after a sequence of real‑time adjustments that depended on tracking fills, applying thresholds, and modelling partial execution. The cost of neutralising the unmatched leg – the cancellation fee and the price concession on the rerouted venue – is explicit in the final P&L.

The same idea on a live price series
Figure 2. Real intraday FX candles from the trading feed Data: live FX feed.

Where it breaks in live markets

The theoretical elegance of a two‑leg spread collapses when any of the underlying assumptions are violated. Queue priority is not static; a new order can jump ahead if it offers a better price or a faster time‑in‑force, pushing the original order deeper into the line and extending its waiting time beyond the expected completion‑time distribution. Venue‑specific minimum sizes can force the trader to split the order into uneven chunks, creating a situation where a partial fill on one side leaves a residual that is smaller than the minimum, and therefore cannot be re‑queued without aggregating with other orders – a process that adds latency and execution risk.

Latency spikes, often caused by network congestion or exchange gateway slowdowns, can widen the window between fills. During that window the market may move sharply, especially in high‑volatility instruments, turning a neutral spread into a directional exposure that can be magnified by stop‑loss cascades on the unfilled side. Moreover, hidden liquidity – iceberg orders or discretionary quotes – can disappear as the price moves, leaving the trader with a thin order book on the pending leg. In such environments the simple rule “keep the order alive for a fixed number of milliseconds” is insufficient; the system must continuously reassess queue position, expected adverse‑selection cost and the option value of staying in line.

The operating path, stage by stage

Stage 1 is order creation, where the trader’s intent is translated into two child orders, each stamped with the target quantity, venue, and the hedge, cancel and reroute thresholds. Stage 2 is queue monitoring; the execution engine subscribes to real‑time market data feeds, updates the filled‑quantity and residual counters after every execution report, and records the time‑stamp of each event. Stage 3 is risk evaluation; the engine computes the projected P&L of the outstanding leg using the latest best‑bid/best‑ask and the completion‑time distribution. If the projected loss breaches the hedge threshold, the engine proceeds to Stage 4, which is corrective action.

Corrective action can be a cancellation, a reroute, or a hedge via a third instrument (for example, a futures contract that offsets the directional exposure). The choice is dictated by the relative cost of each action: cancellation fees, expected price improvement on an alternative venue, and the market impact of a hedge trade. Stage 5 is post‑execution audit; once both legs are filled, the system logs the realised spread, the time taken for each leg, any cancellations, and the final P&L. This audit feeds back into the statistical models that generate the completion‑time distributions used in Stage 3, closing the loop.

Execution and control path
Figure 3. Where the decision is made, checked and confirmed

Controls that act before the damage

A ladder of controls is required to intervene before an unfavourable exposure becomes material. The first rung is pre‑trade validation: the system checks that the intended quantities respect each venue’s minimum size and that the combined notional does not exceed the capital allocation for the strategy. The second rung is real‑time monitoring of queue depth; if the order’s position falls beyond a configurable rank (for example, deeper than the 10th place in the queue), the engine flags a potential liquidity risk and may pre‑emptively reroute.

The third rung is dynamic threshold adjustment. Hedge thresholds are not static percentages; they are functions of market volatility, measured by the realised standard deviation of price changes over the last few seconds, and of the remaining time before the order expires. In periods of heightened volatility the hedge threshold tightens, prompting earlier cancellations. The fourth rung is a “stop‑loss on the spread” – if the realised spread narrows to less than a pre‑set number of ticks while the residual quantity is still significant, the system automatically cancels the open leg to avoid locking in a loss.

The final rung is post‑trade reconciliation. Any deviation between the projected and realised P&L is analysed to identify whether the breach was due to an unexpected latency event, a mis‑estimated completion‑time distribution, or a market microstructure change such as a new hidden liquidity provider. These insights are fed back into the model parameters, ensuring that the controls evolve with the market.

Control ladder
Figure 4. Warn, reduce, stop — decided before the pressure arrives

How to measure whether it is working

Effectiveness is measured on three complementary axes: execution quality, risk containment, and model fidelity. Execution quality is quantified by the average realised spread per trade, adjusted for the cost of cancellations and reroutes. A rising average spread, after accounting for these costs, indicates that the system is capturing the intended arbitrage. Risk containment is assessed by the frequency and magnitude of residual directional exposure – the proportion of trades where the residual quantity exceeded a predefined size after a given time threshold. A low frequency of such events demonstrates that the hedge and cancel thresholds are appropriately calibrated.

Model fidelity is evaluated by comparing the predicted completion‑time distribution with the empirical distribution observed over a rolling window of, say, 10 000 trades. Statistical tests such as the Kolmogorov–Smirnov statistic reveal whether the model under‑ or over‑estimates latency, prompting a recalibration of the parameters that drive the hedge threshold. Additionally, the system logs the number of times a reroute was triggered versus a direct cancellation; a high reroute‑to‑cancel ratio suggests that the alternative venues are providing sufficient liquidity, which is a positive sign for the overall strategy.

The portfolio view

When the arbitrage engine is one component of a broader portfolio, its residual exposures must be aggregated with those from other strategies. The directional risk left by an incomplete spread can be offset by a market‑neutral statistical arbitrage or a delta‑hedged options book, but only if the residual exposure is accurately reported in real time. Portfolio‑level risk metrics – Value‑at‑Risk, stress‑test loss under extreme liquidity events, and the aggregate net‑beta – must incorporate the latency‑adjusted exposure of each leg.

Furthermore, the capital allocation to the arbitrage strategy should reflect the expected “time‑in‑position” of unmatched legs. If the average completion time is long, capital is tied up and unavailable for other higher‑turnover strategies, reducing overall portfolio efficiency. By integrating the completion‑time distribution into the capital‑budgeting model, the desk can decide whether to increase the hedge threshold (accepting a tighter spread for faster turnover) or to allocate more capital to alternative venues that provide quicker fills. In this way, the micro‑level mechanics of a two‑leg spread inform macro‑level decisions about risk appetite, capital deployment and the optimal mix of strategies across the desk.

Do you currently monitor the residual quantity of each leg in real time and adjust your hedge thresholds before the spread loses its neutrality?


About the research behind this lesson

The seminar frames electronic markets as price-time-priority queues. It separates queue value into spread capture versus adverse-selection cost and the option value of retaining a place in line.

Applied to this lesson: An order lifetime therefore cannot be based on elapsed time alone: the system must reassess whether its queue position, expected spread and adverse-selection risk still justify keeping the order alive.


Two live systems, one desk

PULSE-X — power-packed HFT: high-frequency momentum on XAUUSD and EURUSD. System details · Live account

NIC-X — ultra-low drawdown: displaced-print arbitrage for large capital. System details · Live account

Start now: leave your email and request a free trial — we will send the pricing, the connection route and the trial terms. Pricing

Join the market discussion: Telegram @squawklive

Source: High-Frequency Trading and Modern Market Microstructure

Educational content only. Trading leveraged products involves risk.

Chat with XTRSK

Chat ready

Start a chat and the XTRSK team will be notified immediately.

LEAVE A REPLY

Please enter your comment!
Please enter your name here