How do i can get info when my sell order was filled?

How do I can get info when my sell order was filled?
I won’t get info after filling a sell market order about the price.

I use python

Sorry for my English*

There are two basic ways to get info on an order 1) using REST and call the order API. Check if the status is filled or 2) set up a web socket connection and have order status ‘pushed’ to your app.

There’s documentaion on the order API in the docs. Setting up a web socket to stream the order activities is described in the docs here. The choice of which approach to use depends partly upon algo architecture and on timing. Using REST calls, the algo is always pulling data. If there is an error, then the algo can immediately respond. The algo is also ‘stateless’ and can recover easily from a network outage. Using web sockets, the algo is being ‘pushed’ data and must constantly be watching for new data. If there is an error, the algo needs to detect it and re-connect. Some data can be lost.

Does that help? I can provide python code for fetching order info if you wish.

I tried using REST and checking if the order has been executed by requesting every 20 seconds.
Unfortunately alpaca API has limit on how many requests.
The requests have been blocked after some limit has been reached.
So only the streaming option seems to fit in an continues algo trading.

@Shon You should be able to request order status every 20 seconds. The rate limit is 200/minute. The key is to request all orders and not one at a time. It’s very common to poll for order status but another is to check for account activities.

Thank you for your advice.
I am now successfully using REST order API and checking every between 30 and 60 seconds.
I also implemented the streaming web socket and subscribing for order_updates.
Interestingly initially I was able to get from the web socket order_updates the full sequence → Order created as “new”, Order filled. In particular when I execute Limit order and it is not filled immediately.
Now I get only Oder created as “new” but I do not get order filled or closed from the streaming API.
I will keep trying - maybe it is something temporary.

Would you be able to share the code for listening to orders? I’ve been having trouble getting it to work.