Websocket API command confirmations

Hello

When I subscribe to API websocket, I can get messages in two formats.
There’s the messages and then there’s the commandReports.

I run into some issues where an api message says command was successful but then a few moments later the commandReport says the order failed.

The commandReports also come a bit later than the simple messages, just to clarify if I want to be certain that a command has succeeded or failed, I should wait on the command report?

There are Commands, CommandReports and ExecutionReports. To send a command, you just use an API endpoint. To watch a command you want CommandReports, and to know about an order’s execution/fill/working status you want ExecutionReports.

I understand the above. Let’s say I send make a cancel order request.

For example:
It can succeed, fail with a too late message. I’ll get a 200 status response from the api messages but I’ll get a commandReport->commandStatus->ExecutionRejected with with a tooLate failure message.

Do I need to wait for the commandReport to see if the actual command succeeded because if I make a decision based on a 200 status response but then a few moments later the commandReport gives a conflicting message, I am a bit unclear on this.

It’s not only with cancel orders, i’ve had the issue happen with all different types of commands.
I don’t have a log of it happening right now but here’s an example

when I get the SEQ_NUM back, I use that to link the my command with the orderId; sometimes after the SEQ_NUM is returned, I get no errors but a few moments later might get a different result PENDING, WORKING, CANCELLED or REJECTED

Do I have to wait until the order is confirmed with the via the commandReport before moving on or is matching the SEQ_NUM enough?

API -- ENTRY API_CMD_SELL_TO_OPEN_REQUEST SEND [26/04/2022 05:24:20:184312]
[order/placeorder
3.0

{"accountSpec":"xxx","accountId":xxx,"action":"Sell","timeInForce":"Day","symbol":2553027,"orderQty":1,"orderType":"Limit","price":4279.5,"isAutomated":true}]

#### A ---- THIS LINE is from the API, status_code 200
API -- GOT API_CMD_SELL_TO_OPEN_SEQ_NUM 

#### B------ Then I get these messages
API -- [PENDING] STO -- GOT API_CMD_SELL_TO_OPEN_ORDER_ID -- 
[{'entityType': 'executionReport', 'eventType': 'Created', 'entity': {'xxx'}}]

API -- STO -- ORDER ID [3746911793] ORDER STATUS [PENDING]

API -- [PENDING] STO -- GOT API_CMD_SELL_TO_OPEN_ORDER_ID -- 
[{'entityType': 'executionReport', 'eventType': 'Created', 'entity': {'xxx'}}]

API -- STO -- ORDER ID [3746911793] ORDER STATUS [PENDING]

API -- [FILLED] GOT API_CMD_SELL_TO_OPEN_ORDER_ID -- 
[{'entityType': 'executionReport', 'eventType': 'Created', 'entity': {'xxx'}}]

I used the usersync command reports, they seem to come a bit later but that seems to be final.

1 Like