From b74326621169dc487e0fbbda7d3c28f14519e915 Mon Sep 17 00:00:00 2001 From: Martin Michlmayr Date: Wed, 3 Feb 2021 20:14:28 +0800 Subject: [PATCH] Use parameters in get_product_trades() The parameters had no effect since they were never passed to self._send_paginated_message() Fixes #414 --- cbpro/public_client.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/cbpro/public_client.py b/cbpro/public_client.py index e854a163..6b6d0308 100644 --- a/cbpro/public_client.py +++ b/cbpro/public_client.py @@ -122,10 +122,9 @@ def get_product_trades(self, product_id, before='', after='', limit=None, result Args: product_id (str): Product - before (Optional[str]): start time in ISO 8601 - after (Optional[str]): end time in ISO 8601 - limit (Optional[int]): the desired number of trades (can be more than 100, - automatically paginated) + before (Optional[int]): Only get data that occurs more recently than this trade id + after (Optional[int]): Only get data that occurs later than trade id + limit (Optional[int]): Set amount of data per HTTP response. Default (and maximum) of 100. results (Optional[list]): list of results that is used for the pagination Returns: list: Latest trades. Example:: @@ -143,8 +142,16 @@ def get_product_trades(self, product_id, before='', after='', limit=None, result "side": "sell" }] """ + params = {} + if before: + params['before'] = before + if after: + params['after'] = after + if limit: + params['limit'] = limit return self._send_paginated_message('/products/{}/trades' - .format(product_id)) + .format(product_id), + params=params) def get_product_historic_rates(self, product_id, start=None, end=None, granularity=None):