I've run into an issue using the Coinbase Pro sandbox API to test my software.
When placing orders, I POST a client_oid
field along with the rest of the body to the REST API, the order gets filled properly but when the received
message arrives through the websocket stream, the client_oid is always an empty string.
Anyone knows why is that and how to fix this?
Example data POSTed when placing the order:
{
"type": "market",
"side": "buy",
"product_id": "BTC-EUR",
"funds": "1000",
"client_oid": "dev_node-order-1"
}
And here's the matching websocket message of type received
:
{
"type": "received",
"side": "buy",
"product_id": "BTC-EUR",
"time": "2021-08-15T16:57:29.079657Z",
"sequence": 52030416,
"profile_id": "[MY-PROFILE-ID]",
"user_id": "[USER-ID]",
"order_id": "d1f60730-8960-495e-a7eb-cd37baa46768",
"order_type": "market",
"funds": "995.0245866076",
"client_oid": ""
}
As you can see the received client_oid
is empty, any idea why?
So the problem was that the client_oid
needs to be of the UUID format, for example 9bffcb70-13ea-11ec-abc7-7dfab310af81
, if not of this format the field is ignored.