Does anyone know what before
and after
in Coinbase Pro's trades api (url here) correspond to? I have tried linux epoch but that didn't work.
In all honesty, I automatically assumed the before
& after
parameters were intended to be epoch timestamps like you. After reading back through the exchange/cloud docs I realize it's actually a method to incorporate cursor pagination sending REST API requests to the Coinbase API.
Cursor pagination is the most efficient way of navigating through large amounts of ordered data one chunk at a time. When you consider how many real-time data points and historical data point Coinbase possesses, it makes sense why you would only want to get the small amount of data that's relevant to you or the user at any given time.
Here is what the docs say about pagination when using their API:
Coinbase Exchange uses cursor pagination for all REST requests which return arrays.
Cursor pagination allows for fetching results before and after the current page of results and is well suited for realtime data. Endpoints like
/trades
,/fills
,/orders
, return the latest items by default. To retrieve more results subsequent requests should specify which direction to paginate based on the data previously returned.
I suggest you take a quick look at the page in the docs that is dedicated to cursor pagination. It offer a concise explanation of a somewhat complex topic.