How to fetch order status

Hello,

I am trying to create an exit for all order functions. But getting problem to do that.

First executing sell order for exit will be buy sell order but it but get

How to check the status of the last executed order?

For your specific application, initially, you can employ the “get position” functionality accessible through this link:

This function provides a comprehensive view of all successfully executed orders for the current day. Using the instrument_token and the quantity, considering the transaction_type as the opposing side, you can select the order_type and other relevant parameters to suit your requirements. The same approach can be applied if you intend to initiate an exit strategy for your existing holdings using " Get Holdings".

If you wish to cancel an active order, it is recommended to utilize the “Get Order Book” feature. You can find more information on this in the Upstox API documentation under the “Order” section, specifically in the “Get Trade History” operation:

Get Order Book | Upstox Developer API.