DEV Community

Baobab Field Press
Baobab Field Press

Posted on

Cross-exchange arbitrage is a clock problem until you price the fee

Two prices on two exchanges is not a trade. It is four different explanations, and three of them are measurement errors.

Anyone who has put two exchange tabs side by side has seen the same asset at two prices. The instinct is to buy on the cheap venue and sell on the expensive one. The difference you saw was, in order of likelihood: a fee you have not paid yet, a tick of price quantisation, a quote that had not been updated, or a genuine dislocation. Only the fourth is a trade, and on a liquid major at standard retail fees it is the rarest of the four.

I spent an evening building the instrument that tells them apart from public endpoints only, then measured it. Twenty-six endpoints probed for a server clock, a quote and an instrument definition. Twelve of them sampled at 4 Hz for 240 seconds on two assets. Below is the build, the numbers, and the one quantity the sample cannot supply.

The clock was never the problem

Every cross-exchange article begins with clock skew. The measurement does not support the obsession. Of 26 endpoints, 17 publish server time with millisecond precision, and those 17 agree with one another to within 8.7 ms, with fifteen of them inside 5 ms.

What is not synchronised is observation. Round-trip time to the same venues spanned 9 to 291 ms, median near 110 ms, and each venue's publishing cadence ranged from 26 ms between messages to several seconds. So the error in your picture of the market is not 9 ms. It is one hundred to two thousand milliseconds, venue by venue.

The practical consequence: you never need to step a clock. You need three operations.

# 1. measure offset with an NTP-style probe, keep the minimum-RTT sample
offset = server_time - (t0 + t1) / 2      # ms, positive = venue ahead
uncertainty = (t1 - t0) / 2               # half the round trip

# 2. re-stamp every message onto a local monotonic axis as it arrives
local_ts = time.monotonic()

# 3. keep the age of the quote you are looking at
age_ms = (local_ts - last_update[venue]) * 1000
Enter fullscreen mode Exit fullscreen mode

Never let a time synchronisation daemon adjust the wall clock the strategy reads. If the axis can step mid-session, every age you computed before the step is a lie, including the ones your fill model used.

Cadence decides what you can resolve

A quote is true only at the instant it was published. In the same 240-second window, best-quote update counts on SOL were:

Venue Best-quote updates in 240 s
MEXC 11
OKX 144
Crypto.com 188
Poloniex 250

MEXC repriced its best SOL bid eleven times in four minutes while a competitor repriced 250 times. That is not a defect to fix and it is not a latency edge to chase. It is the property that makes a resting order interesting: on a venue that sits still, being the best price is possible for longer than a millisecond.

Canonicalise before you compare anything

Two instruments that look identical are usually not. PEPE and 1000PEPE are different contracts with different ticks and different notionals. A MEXC perpetual is quoted at 0.1 SOL per contract, so a price that looks per-coin is per-tenth-of-a-coin. A USDT book and a USD book carry a stablecoin basis, and a Korean book adds a third currency and a capital-control component on top.

The map has to be explicit and it has to fail closed: if a venue's symbol is not in the map, the venue leaves the consensus rather than entering it with a guessed multiplier.

The measurement

Each venue's mid is divided by its own median over the window, so a book quoted in won or on a different lattice does not distort the reference. The consensus is the median across the other eleven venues in the basket, on a quarter-second grid.

Statistic SOL DOGE
Quarter-second bins 959 960
MEXC tick, bps of mid 1.37 1.75
Median absolute gap to consensus, bps 1.38 2.10
90th percentile 4.13 6.90
99th percentile 4.19 8.17
Maximum in sample 5.16 8.73
Bins beyond 2 bps 39.1% 51.6%
Bins beyond 5 bps 0.1% 22.1%

Read the first two rows together. On SOL the median gap is 1.38 bps and the tick is 1.37 bps. The gap and the price grid are the same size, which tells you most of what you measured is quantisation, not information. On DOGE, where the tick is a wider 1.75 bps of a smaller price, the distribution is broader and 22 per cent of bins sit beyond five bps.

The fee screen, which is the whole decision

MEXC's maker and taker rates come from its own instruments API: spot maker 0, spot taker 5 bps, perpetual maker 0, perpetual taker 2 bps. Against the measured gap distribution, four execution configurations price out like this:

Configuration Round-turn cost Verdict against a 5.16 bps max gap (SOL)
Two-leg taker 14.0 bps (15.0 vs a major anchor) Never pays. Needs more than eight ticks of dislocation.
MEXC taker + perp maker hedge 5.0 bps Needs a gap beyond 5 bps that persists long enough to hedge.
MEXC maker + perp taker hedge 2.0 bps First configuration inside the p90 on DOGE.
MEXC maker both sides 0.0 bps Needs no gap. The spread is the trade; the risk is inventory.

The cheapest two-leg taker round trip in the universe is 14 bps: 5 at MEXC plus 9 at the cheapest spot venue. The largest displacement measured in four minutes was 5.16 bps. That is not a thin edge, it is a different sign.

The conclusion is uncomfortable and it is the useful part: on a liquid major, at these fees, in this window, there was no taker-taker trade and no two-leg trade at all. What existed was a venue whose quote sat still, on a coarse lattice, with a zero maker fee, in front of a consensus that moved.

The code the venue's cadence supports

Shadow quoting rests both sides at the slow venue around a consensus fair value, cancels only when the reference moves a meaningful fraction of a tick, and holds inventory inside a band rather than hedging every fill.

class ShadowQuoter:
    def __init__(self, tick, band_tick=4, k_tick=1, max_age=0.8,
                 skew_per_tick=0.35, min_gap_tick=1.6):
        self.tick, self.band_tick, self.k_tick = tick, band_tick, k_tick
        self.max_age, self.skew, self.min_gap = max_age, skew_per_tick, min_gap_tick

    def quotes(self, fair, venue_mid, pos, last_place, now):
        if fair is None:
            return None
        if abs(fair - venue_mid) / self.tick < self.min_gap:
            return None                       # not stale: nothing to shadow
        centre = fair - self.skew * (pos / self.band_tick) * self.tick
        bid = round(centre - self.k_tick * self.tick, 2)
        ask = round(centre + self.k_tick * self.tick, 2)
        if last_place and now - last_place["t"] < self.max_age:
            if abs(bid - last_place["bid"]) / self.tick < 0.25:
                return None                   # reference has not really moved
        return bid, ask
Enter fullscreen mode Exit fullscreen mode

Two details matter more than the arithmetic. The min_gap guard refuses to quote when the venue is not actually stale, which is most of the time. And the cancel rule is quarter-tick hysteresis, not per-message: a quoter whose reference moves forty times a second cancels forty times a second and never fills.

The number the sample cannot supply

Whether resting both sides is worth money depends on a quantity four minutes of quotes cannot measure: the probability that a resting order at a better price gets filled before the consensus comes back. A quoter filled only when it is wrong has a 100 per cent fill rate on the wrong side.

So the next step is not to size the strategy, it is to measure that number at the smallest position the venue allows, with the adverse-selection estimate subtracted from every fill. In this sample that estimate was 3.3 bps, which is 2.4 ticks on SOL and 1.9 on DOGE. A maker-plus-hedge configuration needs the hedge cost plus that estimate before a quote is even worth placing.

What all of this is

It is the first third of a 33-page manual, The 20-Venue Clock - MEXC-Anchored Cross-Exchange Arbitrage, which carries the rest: the full venue table with offset, RTT and cadence per endpoint, the timebase, the canonical symbol map, four playbooks with code, inventory bands under a no-withdrawal constraint, fourteen failure modes each with a detection rule and a gate, and a key-free monitor in Appendix C that reproduces the whole measurement from public endpoints.

Free, and worth running before anything paid: a public latency probe with no keys and no order path, github.com/nvimuno-dot/venue-latency-probe, plus two three-page tear sheets on the same measurement method, the lead-lag paradox and the 73-hour gold gap.

Measured from public endpoints on 20 November 2026, 19:30 to 20:10 KST, one machine in Seoul. Four minutes on one evening describes the shape of the problem, not the year. No returns are claimed or implied; research, not advice.

Top comments (0)