BTCMarkets / API

API
120 stars 30 forks source link

v3/trades: pagination parameters (before or after) not working #183

Open rakewell opened 4 years ago

rakewell commented 4 years ago

I am using the path v3/trades to get my history of trades of which I can successfully see that I have done 3 trades!

In future cases where I have greater that 200 trades I am assuming the api will return the most recent 200 trades and i can then pass the 'before' pagination parameter to get trades before the most recent 200. I have successfully parsed the response header's BM-BEFORE value and have passed the value in the next request like this:

https://api.btcmarkets.net/v3/trades?status=all&limit=200&before=5259625877

Even though I only have 3 trades so far, I would have thought passing the before parameter on the second request would not return any records as there should be no records before the most recent 3 records that I have received. The API keeps returning all the records regardless of the before parameter I send. I have also tried using the 'after' parameter with the BE-AFTER value but this also return's all the records. With pagination, I don't necessarily know how many records I will receive so I need to stop the enumeration when the returned result set gives zero records but I can't do that since the API always returns records regardless of the pagination parameters. Can you please provide some help on this.

martin-nginio commented 4 years ago

Hi @rakewell

Thanks for your feedback.

There has been a bug in the original implementation of pagination which has been resolved recently so if you are parsing and sending back before variable it should return correct results.

Thanks again for raising this issue.

Regards, Martin