A common use case is to wait for the full execution or cancellation of an order and then take some additional action.
The chapter Trade callback in the AlgoTrader documentation explains how to use a
TradeCallback for this purpose.
In this context it is also important to remember that when trying to close a position there might still be open orders associated with the corresponding security and strategy. It is suggested to cancel all corresponding orders, attach a
TradeCallback to the cancellation and only close the position once all cancels have been confirmed.
Also keep in mind that an order might receive multiple fills in live trading. For example if one wants to send a Stop Order for each executed Order it is important to use the filled quantity and not on the original order quantity.