Coinbase API used to ensure that ClientOrderID to OrderID mapping is unique, that is to say, if CreateOrder request is retried with the same ClientOrderID value, Coinbase used to return the same (previously created) OrderID.
This behavior now seems to be broken. I have the following data-point for verification in (ETH-USD):
I understand that, but… You placed new order, so there is new order on other side (assuming you/bot did not cancel it). I think that would make more sense then returning existing order.
Anyway any change in behavior is not acceptable without some notice before actual change. So I do agree that it is problem… Basically all Advanced Trade API users are beta/alpha/preview testers… This API is simply not ready!
Unfortunately, I don’t have the corresponding log to confirm, so it is a guess at this point.
When recovering from unexpected crashes, my bot does rely on retrying with previous client-order-ids and expecting Coinbase to return the same order-id associated for the client-order-id. I have tested and confirmed this behavior before – otherwise, we can’t guarantee exactly-once semantics anyway.
Since we have the two order-ids, coinbase should be able to confirm what is wrong.
Looks like they have updated description for client_order_id:
A unique ID provided by the client for their own identification purposes. This ID differs from the order_id generated for the order. If the ID provided is not unique, the order fails to be created and the order corresponding to that ID is returned.
This is clearly regression… @Loop_11 and/or @rishabh Is this already know problem?
Hello @chai, I heard back from the team and learned that our documentation is incorrect about the purpose of client order ID. The purpose is to prevent accidental “double click” orders. We cache client order IDs for 24 hours but after then we do not guarantee uniqueness. There hasn’t been any change in this logic recently so I’m not sure why this was observed in error. We will update our documentation to make this clear. We still recommend unique client order IDs for all orders but please take the 24 hour window into account.
24h window makes sense. One cannot expect client order id unique-ness to hold forever. Please consider mentioning this 24h time-window-limit in the documentation. Thanks again.