coinbase / coinbase-pro-node

DEPRECATED — The official Node.js library for Coinbase Pro
Apache License 2.0
844 stars 316 forks source link

getOrders pagination is not working properly #326

Closed Lubomirusa closed 6 years ago

Lubomirusa commented 6 years ago

I'm trying to get the list of all orders by

var param = {}; param.product_id = 'USD-BTC'; authenticatedClient.getOrders(param);

This code works fine if I have less than 100 open orders. But when I have more open orders I tried to do this

var param = {}; var args = {}; args.after = 'ORDER ID OF THE LAST ELEMENT FROM THE LAST REQUEST '; param.product_id = 'USD-BTC'; authenticatedClient.getOrders(param, args);

And the result is not an array but is undefined. Am I doing something wrong here or pagination is not working properly for authenticatedClient.getOrders?

Lubomirusa commented 6 years ago

I just realized that 'after' cursor should be 'created_at' value. So, this code works fine:

var param = {}; param.product_id = 'USD-BTC'; param.after = created_at value of the last order from the last request; authenticatedClient.getOrders(param);

The issue is closed.