[API] How to get active strategy position?

Hello API development team,

How to get the currently active strategy positions using the API?

I punched a few credit spread orders on NIFTY 50, and all are fully executed, showing up in the mobile application under ‘Portfolio’ > ‘Positions’ > ‘Strategy’ section.

How to get those active positions using the API?

I have tried both APIs shown below:

# Short term positions API call.
curl --location 'https://api.upstox.com/v2/portfolio/short-term-positions' --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Authorization: Bearer REDACTED"

# Long term holdings API call.
curl --location 'https://api.upstox.com/v2/portfolio/long-term-holdings' --header 'Content-Type: application/json' --header 'Accept: application/json' --header "Authorization: Bearer REDACTED"

Both return the same empty response.

{
  "status": "success",
  "data": []
}

Thank you.

Hi @ameygangal
Please note that strategy positions are not currently available via the API. As outlined in the response section of the Get Positions API documentation, only the I, D, and CO types are permitted Get Positions | Upstox Developer API

Thanks!

Hello @Ketan,

Thank you for your clarification.

Two more questions

  1. I use the strategy order option in the mobile application because it guarantees order of execution as FIRST BUY, THEN SELL. The place multi order API here https://api.upstox.com/v2/order/multi/place also guarantees that if the order contains both BUY and SELL legs, the BUY will be executed first, then the SELL. If an order is placed using the place multi order API and executed, will those positions reflect immediately using the get positions API here https://api.upstox.com/v2/portfolio/short-term-positions?
  2. How is margin requirement calculated for a credit spread? Upstox and many other brokers offer online pages where margin can be calculated for any kind of option spread, but what is the formula for it? I’ve not found it anywhere online so far. Is it a proprietary algorithm? I’m asking because while you have the margin details API, I’d prefer to not call it on every websocket tick.