Yuzu's API takes a simple approach to pagination, using simple offset/limit parameters in requests to paginate through long lists of data.
The specific pagination paremeters will depend on whether the data you're pulling is timeseries data or not.
Typical pagination params for timeseries data look like the following:
Param | Type | Description |
---|---|---|
limit |
Int |
Used to limit the number of results |
before |
Date or DateTime |
Specify the date before which data should be returned |
after |
Date or DateTime |
Specify the date after which data should be returned |
Pagination params look a bit different, more akin to paginating a SQL query
Param | Type | Description |
---|---|---|
limit |
Int |
Used to limit the number of results |
offset |
Int |
Specify the offset from the last request to use when fetching new data. For example, if you requested 10 items and got 10 back, use an offset of 10 to get the next 10 items |
Most resources enforce a max limit of 500 unless othewise specified. Refer to the schema reference for specific resources.
A common use case is listing all of the crypto trading pairs supported by the API. You would accomplish this by making a request like the following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
On the first request, your variables
would look like:
1 |
|
After processing the results, if there are 500 items, you can make another request to get the next 500 by setting "offset": 500
.