Paging on metrics keyed by exchange or tenor
What's new
limit and before now apply to each series on a metric keyed by exchange or tenor. Until now the API accepted both on these metrics and ignored them, so a request always returned every series in full.
limit returns the most recent N points of each series. Send limit=30 and every exchange comes back with its last thirty points. The keys stay where they are, so the response keeps the shape you already parse.
before is an exclusive timestamp_ms cursor. It cuts every series at the same moment, so each series returns the points older than the value you send.
The paging headers describe the page as a whole. X-Newhedge-From and X-Newhedge-To mark the oldest and newest point in the page across all series. X-Newhedge-Has-More is true when at least one series has older points. X-Newhedge-Next-Before is the cursor that walks every series back without skipping a point. A series that was cut deeper than the others can repeat a few points on the next page, so de-duplicate on timestamp_ms.
A request that sends neither parameter is unchanged. A response with no time axis, such as a table of labelled values, still comes back whole and both parameters are ignored.
How to
Ask for the most recent 30 points of every series:
```
GET /api/v2/metrics/{chart_slug}/{metric_name}?limit=30&api_token=YOUR_TOKEN
```
Read X-Newhedge-Next-Before from that response and send it as before for the next page. The Link header carries the same next-page URL. That URL leaves out api_token, so add your own token before you call it.
Both parameters only narrow a response. Neither reaches further back than the history the API already returns.