Hi All,
I’m running into the following issue where the “user” channel is giving me more information than what I expect to receive.
The following sequence is what I’ve run to reproduce the ‘issue’ that I’m having. I can handle the below mentioned information in code, but is that really correct?
- Open a new order
- Cancel the newly created order
What I expect to receive is 1 message when I open the order and 1 message that I’ve cancelled the order.
But what I receive is the following:
Open:
OnMessageReceived({"channel":"user","client_id":"","timestamp":"2024-01-29T17:40:21.836257473Z","sequence_num":139,"events":[{"type":"update","orders":[{"order_id":"THIS-IS-A-FAKE-ID-0001","client_order_id":"THIS-IS-A-FAKE-CLIENTID-0001","cumulative_quantity":"0","leaves_quantity":"181090","avg_price":"0","total_fees":"0","status":"PENDING","product_id":"BONK-USDC","creation_time":"2024-01-29T17:40:21.668876Z","order_side":"BUY","order_type":"Limit","cancel_reason":"","reject_Reason":""}]}]})
OnMessageReceived({"channel":"user","client_id":"","timestamp":"2024-01-29T17:40:21.836287192Z","sequence_num":140,"events":[{"type":"update","orders":[{"order_id":"THIS-IS-A-FAKE-ID-0001","client_order_id":"THIS-IS-A-FAKE-CLIENTID-0001","cumulative_quantity":"0","leaves_quantity":"181090","avg_price":"0","total_fees":"0","status":"OPEN","product_id":"BONK-USDC","creation_time":"2024-01-29T17:40:21.668876Z","order_side":"BUY","order_type":"Limit","cancel_reason":"","reject_Reason":""}]}]})
Cancel:
OnMessageReceived({"channel":"user","client_id":"","timestamp":"2024-01-29T17:40:31.335159121Z","sequence_num":141,"events":[{"type":"update","orders":[{"order_id":"THIS-IS-A-FAKE-ID-0001","client_order_id":"THIS-IS-A-FAKE-CLIENTID-0001","cumulative_quantity":"0","leaves_quantity":"181090","avg_price":"0","total_fees":"0","status":"OPEN","product_id":"BONK-USDC","creation_time":"2024-01-29T17:40:21.668876Z","order_side":"BUY","order_type":"Limit","cancel_reason":"","reject_Reason":""}]}]})
OnMessageReceived({"channel":"user","client_id":"","timestamp":"2024-01-29T17:40:31.584417714Z","sequence_num":142,"events":[{"type":"update","orders":[{"order_id":"THIS-IS-A-FAKE-ID-0001","client_order_id":"THIS-IS-A-FAKE-CLIENTID-0001","cumulative_quantity":"0","leaves_quantity":"181090","avg_price":"0","total_fees":"0","status":"CANCELLED","product_id":"BONK-USDC","creation_time":"2024-01-29T17:40:21.668876Z","order_side":"BUY","order_type":"Limit","cancel_reason":"","reject_Reason":""}]}]})
As you can see I’m receiving 4 messages in total, 2 messages for when I open the order. First a PENDING message and afterwards an OPEN message.
Upon cancellation I receive another 2, first an OPEN order (why?) and then a CANCELLED order.
Why is the first message upon cancellation an OPEN order, shouldn’t this also be a PENDING order to indicate I’m executing an action which is still pending?
Why is it returning me the status of the order which I have already received previously? This causes some headaches for me as I have no way of filtering this status message unless doing a check if the order has already been processed.
This seems to be inaccurate and I’m wondering how other people are handling this if not in the same manner which seems rather sloppy…
@Coinbase, is this really how you intended this websocket to work?