Skip to content

Commit

Permalink
Use parameters in get_product_trades()
Browse files Browse the repository at this point in the history
The parameters had no effect since they were never passed to
self._send_paginated_message()

Fixes danpaquin#414
  • Loading branch information
tbm committed Feb 3, 2021
1 parent 5658b22 commit b743266
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions cbpro/public_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand All @@ -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):
Expand Down

0 comments on commit b743266

Please sign in to comment.