issue with Carry Forward Positions in Upstox API

Hello,

We are a software development company and have built an ALGO software using the Upstox API. Recently, we noticed an issue where the carry forward positions are showing as zero, even though there are open positions.

We have attached the response from the Upstox API and the terminal screen for your reference. Kindly review and provide a solution at the earliest.

UPSTOX API réponse

[

{

    "symbol": "COLPAL25MARFUT",

    "account": "116_ABHISHEK",

    "broker": "Upstox",

    "trading_account": "8178080065",

    "pl": -2870,

    "realized_pl": 0,

    "unrealized_pl": -2870,

    "ltp": 2481.6,

    "qty": 175,

    "buy_qty": 0,

    "sell_qty": 0,

    "net_qty": 0,

    "avg_buy_price": 0,

    "avg_sell_price": 0,

    "trade": "-",

    "variety": "D",

    "day": "28-Feb-2025"

},

{

    "symbol": "NIFTY25MARFUT",

    "account": "116_ABHISHEK",

    "broker": "Upstox",

    "trading_account": "8178080065",

    "pl": -129207,

    "realized_pl": 0,

    "unrealized_pl": -129207,

    "ltp": 22256,

    "qty": 300,

    "buy_qty": 0,

    "sell_qty": 0,

    "net_qty": 0,

    "avg_buy_price": 0,

    "avg_sell_price": 0,

    "trade": "-",

    "variety": "D",

    "day": "28-Feb-2025"

},

{

    "symbol": "NIFTY25DEC25000PE",

    "account": "116_ABHISHEK",

    "broker": "Upstox",

    "trading_account": "8178080065",

    "pl": 129799.5,

    "realized_pl": 0,

    "unrealized_pl": 129799.5,

    "ltp": 1933.4,

    "qty": 150,

    "buy_qty": 0,

    "sell_qty": 0,

    "net_qty": 0,

    "avg_buy_price": 0,

    "avg_sell_price": 0,

    "trade": "-",

    "variety": "D",

    "day": "28-Feb-2025"

},

{

    "symbol": "NIFTY25DEC23000PE",

    "account": "116_ABHISHEK",

    "broker": "Upstox",

    "trading_account": "8178080065",

    "pl": 27694.5,

    "realized_pl": 0,

    "unrealized_pl": 27694.5,

    "ltp": 918.5,

    "qty": 150,

    "buy_qty": 0,

    "sell_qty": 0,

    "net_qty": 0,

    "avg_buy_price": 0,

    "avg_sell_price": 0,

    "trade": "-",

    "variety": "D",

    "day": "28-Feb-2025"

}

]

Looking forward to your prompt response.

Best regards,
Mitul Mehta

I am waiting for response, can admin help me here?

Hi @mitul88,

Could you please provide the following details to help us investigate further?

  • Your 6-digit user ID.
  • The instrument that was in your carry-forward position but was not present in the API call for positions.
  • Confirmation on whether you are able to see your carry-forward position on upstox app.

Thank you!

  1. User id is 689633
  2. position visible in upstox app but its showing 0 in api

upstox api response is also attached.

@mitul88, in the API response you shared, I can see that all four positions from the screenshot are present. Could you please provide more details on the exact issue you are encountering?

Thanks!

since we dont take backup, that response now we can’t get.

here is todays from another a/c
user id is “AT0897”
net position can be seen in upstox trading app but not in api response.

api response

[{“symbol”:“GOLDM25APRFUT”,“account”:“122_CMMALIK”,“broker”:“Upstox”,“trading_account”:“9811505835”,“pl”:4370,“realized_pl”:0,“unrealized_pl”:4370,“ltp”:85911,“qty”:1,“buy_qty”:0,“sell_qty”:0,“net_qty”:0,“avg_buy_price”:0,“avg_sell_price”:0,“trade”:“-”,“variety”:“D”,“day”:“05-Mar-2025”}]

Hi @mitul88
The quantity field in the response of Get Positions API represents the net quantity, which aligns with what is displayed in the app. Additionally, the API response does not include a net_qty field, so it is unclear how you are calculating it.

Kindly refer to the Positions API documentation for the response structure and a detailed explanation of all fields.

Thank you!

Original response includes “day buy” and “day sell” and “net qty” is based on that only,

getting 0 as position in original response only.

net_qty = day_buy_quantity + day_sell_quantity

{
“exchange”: “MCX”,
“multiplier”: 1,
“value”: 97200,
“pnl”: 290,
“product”: “D”,
“instrument_token”: “MCX_FO|437994”,
“average_price”: 97200,
“buy_value”: 0,
“overnight_quantity”: 1,
“day_buy_value”: 0,
“day_buy_price”: 0,
“overnight_buy_amount”: 97200,
“overnight_buy_quantity”: 1,
“day_buy_quantity”: 0,
“day_sell_value”: 0,
“day_sell_price”: 0,
“overnight_sell_amount”: 0,
“overnight_sell_quantity”: 0,
“day_sell_quantity”: 0,
“quantity”: 1,
“last_price”: 97490,
“unrealised”: 290,
“realised”: 0,
“sell_value”: 0,
“tradingsymbol”: “SILVERMIC25APRFUT”,
“trading_symbol”: “SILVERMIC25APRFUT”,
“close_price”: 97201,
“buy_price”: 97200,
“sell_price”: 0
}