danpaquin / coinbasepro-python

The unofficial Python client for the Coinbase Pro API
MIT License
1.82k stars 732 forks source link

get_product_trades after and before parameters #296

Closed kenfehling closed 6 years ago

kenfehling commented 6 years ago

When I try to use these parameters as specified (passing in date strings) I get a response:

Invalid value for pagination after

However if I use integer ID numbers it works: https://api.gdax.com/products/BTC-USD/trades?after=2

Am I maybe doing something wrong or are these not actually supposed to work with dates, only ID numbers?

barti commented 6 years ago

see line122 of public_client.py

def get_product_trades(self, product_id, before='', after='', limit='', result=[]):`

limit is defaulted to empty string, while when checking lines 128-129

limit (Optional[int]): the desired number of trades (can be more than 100,
    automatically paginated)

and 154-156

if limit and limit < 100:
# the default limit is 100
# we only add it if the limit is less than 100

it should be limit=100 (line 122) Fixed locally and works, sorry have no experience with github to fix it here.