Reliability in Systems Development
Prototype

Mexico–United States arbitrage monitor

An arbitrage monitor between the Mexican exchange and the United States markets: pairs crossed by ADR ratio and exchange rate, spread net of costs, and a state machine that knows what to do when only one leg fills.

Prototype · demonstrable

Mexican pricesBMV · BIVAUS pricesADR / underlyingFX rateUSD/MXNNormalisercanonical quote · delay per sideOpportunity engineADR ratio · net spread · limitsLeg state machinepartial fills, rejects, 4 policiesWeb monitorlive parameters · kill switchAppend-only journalJSONLBook and exposureper issuer · uncovered alert · P&LSimulated execution: fill / partial / reject, latency with jitter
Prices from both sides become one canonical quote; the engine evaluates the spread net of costs and hands the opportunity to the leg machine, which is the only place that decides what happens to an order. Everything it decides lands in the journal and in the monitor.

How it works

01

Pairing

Five crossed pairs joined by ADR ratio and exchange rate. The canonical quote carries the delay measured per side as reception minus market time, so a stale price never looks like an opportunity.

02

Net spread

The engine works on the spread net of costs, not on the gross difference. Below the threshold there is no opportunity, however wide the raw gap looks.

03

Leg state machine

Partial fills and rejects are the normal case, not the exception. When one leg does not go in there are four policies: wait, cancel the other, hedge, or unwind.

04

Limits and kill switch

Exposure per issuer with an uncovered alert, operating limits, P&L, and a switch that stops everything with one click.

05

Append-only journal

Every decision is written down before it is acted on. What happened can be reconstructed line by line.

06

Web monitor

Pairs, chart, legs, exposure, parameters changed live and the uncovered-position resolver.

Where it stands

It is a prototype, and we say so plainly. It runs a replay of five recorded days at 60× or a public feed delayed by about fifteen minutes; execution is simulated per leg with fill, partial and reject probabilities, latency with jitter and timeouts. Forty-seven tests, none of them touching the network.

Working today
  • Opportunity engine with spread net of costs
  • Leg machine with four policies
  • Exposure, limits, P&L and kill switch
  • Append-only journal
  • Live web monitor
  • 47 tests without network access
Not there yet
  • No real market feed and no order book (bid/ask)
  • No FIX gateway and no real orders
  • ADR conversion cost is not modelled
  • It does not survive a restart yet
  • No latency figure is promised until it is measured

Take it to production

The path from here is an adapter to the institution’s own market-data bus, a certified FIX gateway per leg, and the executions posting into the platform’s book. If that is the road you are on, we would like to hear about it.