Can we have a websocket to listen on subsequent events related to those orders originally placed through REST API endpoints - /placeorder and /placeoso?
We like to use to use small stop losses. As the stop loss orders are rejected by the exchange in certain volatile conditions, we would like to listen for rejection messages and place a new stop loss order.
I hope this makes sense. Please advise. Thank you!
Yes you can use the real time User Data socket. Subscribe to user/syncrequest to start a subscription to get a live feed on user data. Initially you’ll receive a big response object that looks like the response object for this api doc operation. As soon as you place an order, you’ll receive through that websocket messages like this:
There are a few entityTypes that you could watch for. You can watch ExecutionReports to see when a pending order has been filled, or to see rejection status on an order. Or you could watch directly for Orders, which once filled will also come through this way. You can watch for any of the entities listed in that big response object from the link above.