Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use parameters in get_product_trades() #422

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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