XCore HFT / Trading Lab
Bad timestamps can invent HFT alpha
Quantitative execution, market-microstructure, and risk-control research from XTRSK.
What this problem really is
The illusion of ultra‑fast alpha often originates from a mismatch between the clock that marks an event and the clock that records it. In a typical high‑frequency workflow the exchange stamps a trade or a quote with its own reference, the gateway may re‑timestamp on receipt, and the local order‑management system adds a final timestamp when the message is written to the database. When those three timestamps are not stored separately, the analyst is forced to assume they are identical, and the resulting time series can appear to contain predictive information that never existed in real time. The discrepancy is usually measured in microseconds, but for a strategy that profits on sub‑millisecond edges the error is catastrophic.
The core of the problem is that the research pipeline treats “when the data was recorded” as “when the information became actionable”. If the exchange’s trade message arrives 80 µs after a quote change but the gateway erroneously records the trade as having occurred 30 µs earlier, a back‑test will suggest that the trade anticipated the price move. The apparent alpha is a phantom created by a faulty temporal ordering, not a genuine market inefficiency. This mis‑alignment is not a rare edge case; it is an endemic risk in any environment that stitches together multiple feeds, each running on its own hardware clock.

How the mechanism works, step by step
First, the exchange publishes a market data packet that contains a sequence number, a nanosecond‑resolution timestamp, and the payload (quote or trade). The packet travels over a dedicated fibre or microwave link to the broker’s gateway, where it is deserialized and placed on a local message bus. At this point the gateway adds a receive timestamp derived from its own system clock, which may already be offset by a few hundred nanoseconds because of clock drift or network jitter.
Second, the order‑management system (OMS) subscribes to the bus, matches the packet to any outstanding orders, and finally writes a row to the persistence layer. The OMS timestamp is generated after any internal processing, such as risk checks or routing decisions, and therefore lags the original exchange time by a deterministic but variable amount. If the three timestamps are collapsed into a single field, the analyst loses the ability to reconstruct the true causal order of events. The only reliable way to preserve causality is to store the exchange timestamp, the gateway receive timestamp, and the OMS write timestamp as distinct columns, together with the original sequence number and any correction messages that the exchange may later emit.
A worked example with real numbers
Consider a micro‑price‑impact study on a liquid futures contract. The exchange sends a trade at 10:15:30.123456789 UTC, timestamped 123 µs after the preceding quote update (which bears the exchange timestamp 10:15:30.123333333 UTC). The packet traverses a 30 km fibre link that adds 45 µs of propagation delay. The gateway, whose clock is known to be 20 µs ahead of the exchange, records a receive timestamp of 10:15:30.123456814 UTC. The OMS, after performing a latency‑sensitive risk check that takes 12 µs, writes the event to the database with a local timestamp of 10:15:30.123456826 UTC.
If the analyst keeps only the OMS timestamp, the trade appears to have occurred 173 µs before the quote change (10:15:30.123456826 UTC versus 10:15:30.123333333 UTC). A naïve back‑test would then credit the strategy with a 0.5 % price‑move prediction, because the trade is interpreted as a leading indicator. In reality the quote change arrived at the gateway 25 µs earlier than the trade, and the market moved in response to the quote, not the trade. By preserving the three timestamps and the exchange sequence number, the reconstruction shows the true order: quote update → trade → OMS write. The spurious alpha disappears once the temporal mis‑alignment is corrected.

Where it breaks in live markets
In production environments the problem escalates when the infrastructure is stressed by burst traffic. During a news‑driven spike, the exchange may send correction messages that retroactively adjust timestamps for a batch of trades. If the OMS discards those corrections, the stored chronology becomes permanently corrupted. Moreover, hardware clock drift is not constant; temperature changes in a data centre can shift a server’s oscillator by several tens of nanoseconds per hour, enough to invert the order of events that are only a few microseconds apart.
Another failure mode appears when the gateway applies packet coalescing to reduce CPU utilisation. By bundling several messages into a single buffer, the gateway assigns a single receive timestamp to all of them, effectively erasing the fine‑grained arrival differences. When the bundled messages include both a quote and a trade that arrived on opposite sides of a price move, the resulting timestamp homogenisation creates a false lead‑lag relationship. The strategy may then appear to generate profit on a “future” signal that never existed in the live market.
The operating path, stage by stage
The first stage is the exchange feed ingestion point, where the raw nanosecond timestamp and sequence identifier are captured verbatim. The second stage is the gateway processing layer, which must log the exact moment the packet is placed onto the internal bus, together with a measured clock offset to the exchange’s reference (often obtained via PTP or GPS disciplined oscillators). The third stage is the OMS, which records the moment the event is used for order decision making, after any latency‑critical logic has been applied. The fourth stage is the archival database, where all three timestamps, the original sequence number, and any subsequent correction messages are persisted without transformation.
Between each stage a monitoring daemon checks for monotonicity of sequence numbers and for gaps that could indicate packet loss or out‑of‑order delivery. If a gap is detected, the system raises an alert and optionally requests a replay from the exchange’s historical feed service. The final stage is the analytics pipeline, which reconstructs the true causal chain by aligning the three timestamps using the measured clock offset and drift curves, and then feeds the corrected series to the back‑testing engine.

Controls that act before the damage
A robust defence begins with a disciplined time‑synchronisation architecture. All servers that touch market data should be disciplined by a single reference clock, such as a GPS‑derived Pulse‑Per‑Second signal, and the offset of each node must be logged every second. The gateway must retain the raw exchange timestamp in a dedicated column and reject any attempt to overwrite it with a local time.
The OMS should enforce a strict policy that any order‑routing decision must be based on the exchange timestamp, not on the local receipt time. This prevents a scenario where a stale quote is used because the local clock appears earlier than the exchange’s. Additionally, the system must retain every correction message that the exchange publishes; discarding them would cement the error in the historical record. Finally, a pre‑trade validation layer can simulate the arrival order of a quote and a trade using their sequence numbers; if the simulated order contradicts the observed timestamps, the trade is flagged for manual review before it is allowed to influence the strategy.

How to measure whether it is working
The primary metric is the distribution of the offset between exchange timestamps and local receipt timestamps after applying the measured clock drift. A well‑behaved system shows a tight Gaussian‑like cloud centred near zero, with a 99th‑percentile absolute deviation of less than 5 µs for a sub‑millisecond strategy. The secondary metric is the rate of out‑of‑order sequence numbers after alignment; a healthy pipeline should have a rate below one per million messages.
A third, more subtle, measure is the “knowledge latency”: the interval between the moment the exchange first makes an event public (exchange timestamp) and the moment the strategy could have acted on it (gateway receipt timestamp after accounting for network propagation). By plotting the cumulative distribution of knowledge latency, one can verify that the median latency meets the design target while the tail does not exhibit spikes above the acceptable threshold (often set at the 95th percentile).
Finally, the loss distribution of cancellations and routing failures must be examined. Following the research approach that builds risk from return distributions rather than a single realised outcome, the analyst should construct a histogram of cancellation‑to‑execution ratios during periods of abnormal latency. Heavy tails in this histogram indicate that the timing controls are not capturing rare but costly events.
The portfolio view
When the temporal integrity of the data pipeline is assured, the portfolio‑level performance metrics become trustworthy. The realised Sharpe ratio, the maximum drawdown, and the tail‑risk statistics now reflect genuine market exposure rather than artefacts of mis‑ordered timestamps. Moreover, the attribution of alpha to specific micro‑strategies can be performed with confidence, because the causality chain from quote to trade to fill is preserved.
If the timing controls fail, the portfolio may appear to generate a consistent excess return that evaporates as soon as the strategy is deployed in live trading. The discrepancy is not a failure of the predictive model but a failure of the data infrastructure. By continuously monitoring the clock offset, sequence integrity, and knowledge latency, the desk can detect drift before it contaminates the back‑test, and can roll back any affected periods to a clean data set. In this way, the integrity of the timestamps becomes a risk factor that is managed alongside market risk, execution risk, and capital risk.
Do you currently store exchange, gateway and local timestamps separately, and have you quantified the knowledge latency distribution for each of your high‑frequency signals?
About the research behind this lesson
Andrew Lo's lectures build risk analysis from return distributions and statistical measures, rather than treating one realised result as a complete description of risk.
Applied to this lesson: For a fast strategy, median latency or average fill quality is not enough. The review has to include tail delays, stale-order frequency and the loss distribution when cancellation or routing behaves abnormally.
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: Risk and Return
Educational content only. Trading leveraged products involves risk.
Chat with XTRSK
Chat ready
Start a chat and the XTRSK team will be notified immediately.