QuantSet Docs Developer console

Continue a snapshot-pinned read

Pass the cursor and warehouse generation from the same page to retrieve the next slice.

Fetch another price page

Start with ticker, dates and a limit. If next_cursor is null, the read is complete. Otherwise copy it unchanged into cursor, copy snapshot_id and repeat the original filters, limit and representation. Use URL encoding for both values.

import os
import requests

url = "https://api.quantset.dev/api/v1/prices"
headers = {"X-API-Key": os.getenv("QUANTSET_API_KEY", "mw_demo")}
filters = {"ticker": "NVDA", "limit": 5}
first = requests.get(url, headers=headers, params=filters, timeout=15)
first.raise_for_status()
page = first.json()
if page["next_cursor"] is not None:
    params = {**filters, "cursor": page["next_cursor"], "snapshot_id": page["snapshot_id"]}
    second = requests.get(url, headers=headers, params=params, timeout=15)
    second.raise_for_status()

Assemble the result

Daily bars are ascending within each page, and subsequent pages reach further back. Prepend each older page to build ascending history. Other endpoints document their own ordering. A limit alone does not imply cursor support.

Handle a changed snapshot

On 409 snapshot_changed, discard partial pages and restart the query. On 422 invalid_cursor, check the filters, operation and snapshot_id. CSV reads carry the generation in X-Warehouse-Snapshot-Id and the continuation in X-Next-Cursor when more rows exist.