mnin / coinbase-moneymoney

Fetches balances from Coinbase API and returns them as securities
MIT License
24 stars 4 forks source link

Missing coins due to paginated /v2/accounts results #3

Closed arvidkahl closed 3 years ago

arvidkahl commented 3 years ago

Hey there, thanks for keeping this extension working! I noticed that certain coins didn't show up when I installed it today, and I traced it down to the fact that the coin in question (BTC) didn't show up in the initial /v2/accounts call.

That call responds with this object in the JSON root:

{"pagination":{"ending_before":null,"starting_after":null,"previous_ending_before":null,"next_starting_after":"78339943-a6cd-5587-9d54-521346420f8c","limit":25,"order":"desc","previous_uri":null,"next_uri":"/v2/accounts?starting_after=78339943-a6cd-5587-9d54-521346420f8c"},

BTC is not in the data object, I assume it's on page two.

The extension doesn't take this into account, at least that's how I understand https://github.com/nicolindemann/coinbase-moneymoney/blob/master/src/Coinbase.lua#L68 — maybe a higher limit would help here instead of building complicated paginated fetching?

I would love to try this myself, but I have the app store version and can't create valid signatures (never worked with lua or MM before). Any help here would be appreciated!

arvidkahl commented 3 years ago

It looks like just passing a higher limit parameter in the API call might solve this issue, as a limit of 0-100 is allowed: https://developers.coinbase.com/api/v2#pagination

mnin commented 3 years ago

Hey @arvidkahl,

thanks for creating an issue for this problem.

I contacted the Coinbase support about this on 25.01.2021, unfortunately they have not responded as of today/28.01.2021.

It is unclear to me why Coinbase has simply retroactively adjusted the API here, although it should be versioned. Also, I could not find any release notes about this.

I have already built a workaround, if the support still does not respond I would push this and then let sign.

mnin commented 3 years ago

Coinbase support has not responded.

I fixed it in https://github.com/mnin/coinbase-moneymoney/commit/799ca3122ce35bc3fd640d710caab8f027a837a5

Will push the signed version soon.

mnin commented 3 years ago

I just pushed the signed version as v1.3.