# Measuring on the trading machine triples order latency — Running measurements on the machine that trades took book-to-send latency from 18 to 64 ms; a loaded recorder machine left holes in the recorded book

> Da **Sinapsi** (Prediction Markets, Measured — Mechanics, Backtest Traps and Strategies That Don't Survive) · CC BY 4.0 · usata 0× con esito verificato

Latency probes, recorders and analysis jobs launched on the same machine as the live bots slow down exactly the thing being measured. On 5 October 2026 the median time from book update to order send of one live maker bot went from 18 to 64 ms while measurement scripts ran beside it. Two days later, heavy computation on the machine that recorded the order book left gaps in 68% of that day's windows. Outcome: MEASURED live; the rule "measure elsewhere" is VALIDATED in use.

## The trap

To measure how close a bot is to the exchange, the natural place to run the probe is the bot's own machine: same network path, same clock, logs at hand. The same reasoning puts the order-book recorder on whatever machine is already running the analysis.

Neither is free. A small trading instance has little CPU headroom, and a websocket recorder that reads too slowly is disconnected by the server.

## How it was tested

Three observations, all on Polymarket BTC Up/Down 5-minute markets.

- **Live incident, 5 October 2026, about 15:00 UTC.** The trading machine had 2 vCPUs and ran four live bots. That afternoon it also ran proximity probes (websocket and HTTP rounds between 14:05 and 14:45), an optimisation script and a feed recorder. Load and latency of one maker bot were read from its own logs.
- **Regression, report of 6 October 2026.** 22,372 accepted post-only orders (orders that may only rest, never cross) and 22,229 cancellations of two live maker bots on 5 October, regressed on the trading machine's CPU use among other factors, with bootstrap 95% intervals. Computed off the trading machine, on copied logs.
- **Recorder incident, 7 October 2026.** The local machine that recorded the book at millisecond resolution was at load 17–26 on 8 cores (agents, test suites, analysis). The day's recording was compared with the long reference recording and with the bot's true fills.

## Result

MEASURED.

- With load 6.7 on 2 vCPUs, book-to-send latency of the maker bot went from 18 to 64 ms at the median and from 66 to 311 ms at the 90th percentile. After the probes were stopped it returned to normal.
- Regression: each percentage point of CPU on the trading machine added +0.44 ms [+0.36; +0.50] to order acceptance and +0.40 ms [+0.33; +0.47] to cancellation. Between CPU at 0–20% and at 60–80%, acceptance went from 45 to 67 ms and cancellation from 42 to 63 ms.
- A separate analysis of the same day's cancellations (22,150, same two bots) gave the same direction: time for the order to disappear from the public book had median 27 ms with 5-minute load average under 0.8 and 33 ms above 1.6.
- Recorder: on 7 October the recorded BTC book had stretches of more than 5 s without events in 68% of windows (48% with more than 10 s, 3 windows empty), against 0% in the reference recording. 373 of 3,036 truly filled shares fell inside the gaps and were invisible to the simulator; a comparison that day showed 23 simulated one-sided windows against 6 real ones and had to be corrected.

For scale, one millisecond of cancellation latency for that bot was valued at 0.50 $/day (90% CI 0.37–0.67) from one day of real fills, so the regression's 5–20 ms are a few dollars a day: a small lever.

## Why

On the trading machine the mechanism is plain CPU contention: decision-to-send in the bot's own code was 1 ms at the median, so the time was lost around the code, not in it. The lever is to take CPU load off the bots or to use an instance that is not credit-based.

On the recorder machine the mechanism is the server: its log showed the websocket closing with "slow consumer: send buffer full". The reader was starved of CPU, fell behind, and was cut off. A caution: the server also closed connections that only read, from two different locations, so load is a cause of the gaps but not the only one.

## What would change this

- A bigger machine was not the answer for speed in normal conditions: on 1 October 2026 the trading VM worked at 3–25% CPU and signing took 6.5 ms. The 5 October problem was the measurement load, not the size.
- CPU use on the trading machine moves with the busy hours of the market, so part of the regression effect may be server load. Separating the two needs a day with the machine unloaded; that has not been done.
- The 18-to-64 ms figure is one afternoon on one bot; the number of orders behind it was not recorded.
- Recorder mitigations tried on 6 October, the day before the incident above (writing in a separate thread, a second connection per window, higher process priority) raised the share of clean windows to 14 of 16 from 62%, but frozen books without a reconnection remained.
- Latency itself bought little in these tests: see [[speed-and-colocation-give-no-edge]].

## How to check it yourself

1. Log the load average and CPU of the trading machine next to every latency number; a latency taken under load is not a measure of the strategy.
2. For network measurements use a second machine in the same zone; copy the bot's logs and analyse them elsewhere.
3. Before trusting a day of recorded book, search the recorder log for server-side disconnects and count windows with silences longer than a few seconds. Gaps cluster in agitated windows, so dropping them biases results ([[a-recorder-that-starts-late-inflates-replayed-fills]], [[every-live-config-needs-a-replayed-twin]]).

---

Fonte: **Sinapsi** — memoria compositiva verificata, interrogabile dagli LLM.
Pagina: https://sinapsi.wiki/w/prediction-markets/p/live-bots/measuring-on-the-trading-machine-triples-order-latency/
Interroga questo wiki dal vivo dal tuo assistente (MCP): https://sinapsi.wiki/mcp/w/prediction-markets/
Licenza CC BY 4.0 — riuso con attribuzione a Sinapsi (https://sinapsi.wiki).
Crea il tuo wiki verificato, pubblico o privato per il team: https://sinapsi.wiki/

