polygon-io / client-js

The official JS client library for the Polygon REST and WebSocket API.
MIT License
186 stars 59 forks source link

Incorrect trades order when pagination: true #183

Open tradingproject19 opened 1 year ago

tradingproject19 commented 1 year ago

Hello,

I am facing an ordering issue.

const globalFetchOptions = { pagination: true, // trace: true, }; const rest = restClient( "APIKEY", "https://api.polygon.io",

globalFetchOptions ); client.stocks .trades(ticker, { "timestamp.gte": String(from * 1000 * 1000), "timestamp.lte": String(to * 1000 * 1000), limit: limit, sort: "timestamp", order: "asc", }) .then((data) => { console.log(data.results[0], data.results[data.results.length - 1], 'api results outof order'); }); When I set pagination to true in restClient, then the final output is not in correct order.
justinpolygon commented 1 year ago

I'll check this out thanks for reporting.

tradingproject19 commented 1 year ago

Thank you so much.

tradingproject19 commented 1 year ago

@justinpolygon is there an update on this?

justinpolygon commented 1 year ago

Hey, @tradingproject19 -- I'm still checking with out and will reply later today.