API polling
API polling is getting fresh data through repeated requests on a schedule: every N seconds the client asks the server what has changed. Bots and dashboards work this way with a REST API, which never sends anything on its own: each poll is a plain HTTP GET.
Interval and data freshness
Polling faster than the data updates gains nothing: the server returns the same snapshot. In Genesis API, data freshness depends on the plan: the output refreshes every 60 seconds on Trial, 30 on Start, 10 on Pro and 5 on Max, and that value comes in the meta.freshness_sec field. The snapshot build time is in meta.updated_at; the same value in two responses in a row means the second request was wasted.
Hypothetical example: on Trial a bot polls an endpoint every 10 seconds. Of the six requests a minute only one brings new data; the other five repeat the snapshot and still use quota unless the bot sends If-None-Match.
import os
import time
import requests
URL = "https://api.genesisarbitrage.com/v1/arbitrage/spot-spot"
HEADERS = {"X-API-Key": os.environ["GENESIS_API_KEY"]}
while True:
r = requests.get(URL, headers=HEADERS,
params={"min_spread": 1}, timeout=10)
if r.status_code in (429, 503):
time.sleep(int(r.headers.get("Retry-After", "5")))
continue
r.raise_for_status()
meta = r.json()["meta"]
print("pairs:", meta["count"], "snapshot:", meta["updated_at"])
# polling faster than the plan's refresh step is pointless
time.sleep(meta["freshness_sec"])
How many calls polling uses
Polling one endpoint every 10 seconds: 2,592,000 ÷ 10 = 259,200 calls in 30 days. The Genesis API quota also covers 30 days.
| Plan and quota | Interval = freshness | Calls per endpoint | Endpoints within quota |
|---|---|---|---|
| Trial, 500K | 60 s | 43,200 | 11 |
| Start, 2M | 30 s | 86,400 | 23 |
| Pro, 5M | 10 s | 259,200 | 19 |
| Max, 10M | 5 s | 518,400 | 19 |
The math ignores 304 responses. On Pro, 19 endpoints every 10 seconds average 1.9 requests per second against a limit of 5. Spread the requests out: 19 requests at once would exceed the limit, and the server would answer with HTTP 429.
Polling, WebSocket and webhooks
| Method | Who starts the transfer | Good for |
|---|---|---|
| Polling | The client, on a schedule | Data that updates at a known step; any HTTP client will do |
| WebSocket | The server, over an open connection | A continuous stream of changes: exchange order books and trades |
| Webhook | The server, with a request to your URL | Rare events, if you have a public HTTPS endpoint |
Genesis API has no WebSocket and no webhooks: data is served over REST, and the plan sets the freshness. Polling at meta.freshness_sec is the standard way to work with it; ways to cut traffic and calls are in How to poll an API without hitting limits.
See also: rate limit, plans and limits in the docs, response format, Genesis API limits.
Questions and answers
How often should I poll Genesis API?
No more often than your plan's meta.freshness_sec: every 60 seconds on Trial, 30 on Start, 10 on Pro and 5 on Max. Polling faster returns the same data.