Latency
Latency is the time between an event in the market and the moment data about it reaches your code. Hypothetical example: a trade prints on an exchange at 12:00:00 and your script gets the new price at 12:00:12, a latency of 12 seconds.
What latency is made of
| Stage | What adds time |
|---|---|
| Exchange | Publishing a trade or book change in its API |
| Collection | Receiving data over WebSocket or REST, reconnects |
| Computation | Matching exchanges, recalculating spreads and books |
| Delivery | The plan's output refresh step and the network to your server |
| Your code | The polling interval and response handling |
Some of these stages show up in Genesis API response fields. meta.updated_at is when the snapshot was built, and meta.freshness_sec is the output delay on your plan: 60, 30, 10 or 5 seconds. Order books have their own markers: age_sec is the book's age and stale flags a book older than 30 seconds; books lag the exchange by 5–20 seconds (market order book in the docs).
Stale prices in arbitrage
Hypothetical example: a snapshot taken 15 seconds ago shows a coin at $10.00 on exchange A and $10.12 on exchange B.
| Moment | Price on A | Price on B | Spread |
|---|---|---|---|
| In the snapshot | $10.00 | $10.12 | 1.2% |
| On the exchange now | $10.00 | $10.03 | 0.3% |
Two trades at a 0.1% taker fee each eat 0.2%, so instead of the 1.2% in the snapshot only 0.1% is left. The higher the latency, the more often a bot sees a spread that is already gone from the exchange.
Response time and data freshness
Server response time and data freshness, meaning how long ago the snapshot was built, are different numbers. Hypothetical example: the response arrives in 0.2 seconds while the snapshot inside is 9 seconds old. You can measure both:
import os
import time
import requests
r = requests.get(
"https://api.genesisarbitrage.com/v1/arbitrage/spot-spot",
headers={"X-API-Key": os.environ["GENESIS_API_KEY"]},
params={"coin": "BTC"},
timeout=10,
)
r.raise_for_status()
meta = r.json()["meta"]
# response time: from sending the request to parsing the headers
print("response time:", round(r.elapsed.total_seconds(), 2), "s")
# data age: time since the snapshot was built
print("data age:", round(time.time() - meta["updated_at"]), "s")
Data age is computed against your server's clock: if the clock drifts, the error goes into the result, so keep the time synced (NTP).
See also: API polling, WebSocket, response format, automation risks: stale data, errors, keys.
Questions and answers
What is the latency of Genesis API?
The output refreshes every 60 seconds on Trial, 30 on Start, 10 on Pro and 5 on Max; the exact value for your key comes in meta.freshness_sec. Your polling interval and the network add to it.