coinbase / coinbase-pro-node

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

Support Idempotent Trades #352

Closed AntonioJuliano closed 4 years ago

AntonioJuliano commented 5 years ago

This is more a feature request for the Coinbase Pro API itself rather than this library. Please let me know if I should move it elsewhere.

It would be immensely helpful if an idempotent id could be passed to all relevant state changing actions including: buy, sell, placeOrder, convert, deposit, withdraw. If a request were received with an already used idempotent id, it would be a noop and would ideally return a success status code. The client_oid field on the place order endpoint doesn't seem to do any deduplication (https://docs.pro.coinbase.com/#place-a-new-order).

Without an idempotent id, it's difficult to ensure a given trade/action does not occur more than once. If the client has multiple redundant instances all trying to make the same trade they need to implement their own locking / deduplication, which can be fairly complicated. It's much easier from a client perspective to just have a deterministic idempotent id. Even if there is only once client instance, requests can timeout and then the client must try to determine if the trade went through or not by querying GET endpoints.

drewrothstein commented 4 years ago

Hi, we are closing out PRs + Issues as this project is being archived.