CayøLargo
← Back to siteAPI ReferencePricingChangelog
v1.0Swagger ↗

Getting Started

Pagination and Bulk Data

How to fetch large time ranges efficiently using cursor-based pagination with from, to, and limit.

How pagination works

Every time-series endpoint accepts three query parameters that control the window of data returned:

fromStart of the time window (ISO 8601, UTC). Default: latest snapshot only.
toEnd of the time window (ISO 8601, UTC). Default: now.
limitMaximum rows returned. Default and max depend on tier: Pro 500, Alpha 10,000.

Results are sorted by timestamp descending (newest first). If count in the response equals your limit, there is likely more data. To fetch the next page, set to to the oldest timestamp in your current batch and repeat.

How much data is there?

Snapshot endpoints (one row per coin per 10-minute cycle):

Time rangeRows (1 coin)At limit=500At limit=5000
1 day1441 request1 request
7 days1,0083 requests1 request
30 days4,3209 requests1 request
90 days12,96026 requests3 requests

Per-option endpoints (greeks/snapshot, liquidity/options) multiply by ~2,500 options per cycle. A single 10-minute snapshot is one request. Historical per-option data requires pagination.

Python: fetch 30 days of vol/surface

python
import requests
import time

API_KEY = "clg_alpha_YOUR_KEY"
BASE    = "https://api.cayolargo.fi"
COIN    = "BTC"

# 30 days of 10-min data = 4,320 rows
params = {
    "coin":  COIN,
    "from":  "2026-02-10T00:00:00Z",
    "to":    "2026-03-12T00:00:00Z",
    "limit": 5000,
}

all_rows = []

while True:
    r = requests.get(
        f"{BASE}/v1/vol/surface",
        params=params,
        headers={"X-API-Key": API_KEY},
    )
    data = r.json()
    batch = data["results"]
    all_rows.extend(batch)

    # If we got fewer rows than limit, we have everything
    if data["count"] < params["limit"]:
        break

    # Move the cursor: set "to" to the oldest timestamp in this batch
    oldest = batch[-1]["timestamp"]
    params["to"] = oldest

    # Be polite
    time.sleep(0.5)

print(f"Fetched {len(all_rows)} rows")

Tips

Use max limitSet limit to the maximum for your tier (200 / 500 / 10,000). Fewer requests = faster bulk downloads.
Filter by coinThe coin parameter is required on most endpoints. If you need all 6 coins, loop over each coin separately.
Latest onlyOmit from and to entirely to get just the latest snapshot. No pagination needed.
DeduplicationWhen paginating, the boundary row (oldest in page N) may appear again as the newest in page N+1. Deduplicate by timestamp after collection.
Rate limitsPro: 5,000 req/day. Alpha: 50,000. A 30-day bulk download at limit=5000 uses 1 request. Plan accordingly.
Backfill onceFetch the full history once, store locally, then poll the latest snapshot every 10 minutes going forward. Do not re-fetch the full range on every run.

See Tiers & Limits for per-tier request and row limits, and Response Format for the JSON envelope structure.