Closed TheKeyboardKowboy closed 3 years ago
in the docstring of _send_paginated_message:
def _send_paginated_message(self, endpoint, params=None):
""" Send API message that results in a paginated response.
The paginated responses are abstracted away by making API requests on
demand as the response is iterated over.
Paginated API messages support 3 additional parameters: `before`,
`after`, and `limit`. `before` and `after` are mutually exclusive. To
use them, supply an index value for that endpoint (the field used for
indexing varies by endpoint - get_fills() uses 'trade_id', for example).
`before`: Only get data that occurs more recently than index
`after`: Only get data that occurs further in the past than index
`limit`: Set amount of data per HTTP response. Default (and
maximum) of 100.
Args:
endpoint (str): Endpoint (to be added to base URL)
params (Optional[dict]): HTTP request parameters
Yields:
dict: API response objects
"""
the tldr is that _send_paginated_message abstracts away before
after
and limit
.
but if you're talking about manually specifying these, then yes, it does not.
So how do I get product trades since a specific trade id? Because extrapolating from the Pagination section of the README.md I get:
# Only fetch new trades since last call by utilizing `before` parameter.
new_trades = auth_client.get_product_trades(product_id=some_prduct_id, before=some_trade_id)
But that actually returns a generator that produces all trades in history.
from reading the code, that feature seems to be unsupported.
As mentioned, auth_client.get_product_trades() will produce all trades on a product. We aim to be a wrapper for the official Coinbase API. You will need to create the logic yourself for finding trades since a specific trade id.
Am I just missing something or does the 'get_product_trades()' method not currently supporting the optional parameters for 'before', 'after', and 'limit'?
return self._send_paginated_message('/products/{}/trades'.format(product_id))