Skip to Main Content
POST/NorenWClientAPI/PositionBook

Positions

Fetch net open positions across all products and exchanges for the logged-in account.

Overview

Returns the current position book for the logged-in account — day and carry-forward buy/sell quantities, average prices, last traded price, and realized/unrealized P&L for every open or squared-off position for the trading day.

Purpose

Use this to build a live positions dashboard, compute portfolio-level MTM, or check net exposure per symbol before placing further orders.

Parameters

FieldTypeRequiredDescription
uidstringrequiredUser ID of the logged-in account.
actidstringrequiredAccount ID to fetch positions for (usually same as uid).

Request example

positions = api.get_positions()
const res = await fetch("https://api.shoonya.com/NorenWClientAPI/PositionBook", {
  method: "POST",
  body: `jData=${JSON.stringify({ uid, actid })}&jKey=${token}`,
});
console.log(await res.json());
curl -X POST https://api.shoonya.com/NorenWClientAPI/PositionBook \
  -d 'jData={"uid":"ABC123","actid":"ABC123"}&jKey=<token>'

Response example

json
[
  {
    "stat": "Ok",
    "uid": "ABC123",
    "actid": "ABC123",
    "exch": "NSE",
    "tsym": "EMIL-EQ",
    "s_prdt_ali": "MIS",
    "prd": "I",
    "token": "11530",
    "symname": "EMIL",
    "instname": "EQ",
    "cname": "ELECTRONICS MART IND LTD",
    "frzqty": "552883",
    "pp": "2",
    "ls": "1",
    "ti": "0.01",
    "mult": "1",
    "prcftr": "1.000000",
    "daybuyqty": "200",
    "daysellqty": "200",
    "daybuyamt": "37060.00",
    "daybuyavgprc": "185.30",
    "daysellamt": "36740.00",
    "daysellavgprc": "183.70",
    "cfbuyqty": "0",
    "cfsellqty": "0",
    "netqty": "0",
    "netavgprc": "0.00",
    "upldprc": "0.00",
    "netupldprc": "0.00",
    "lp": "184.75",
    "urmtom": "0.00",
    "bep": "0.00",
    "totbuyamt": "37060.00",
    "totsellamt": "36740.00",
    "totbuyavgprc": "185.30",
    "totsellavgprc": "183.70",
    "rpnl": "-320.00"
  }
]

Error handling

CodeMeaning
Not_OkSession expired or invalid session key — re-authenticate via OAuth.
[]No open or day positions. An empty array is a valid response, not an error.

Best practices

  • Poll on a reasonable interval — this is a snapshot endpoint, not a stream. Use WebSocket order/position updates for real-time changes.
  • netqty of "0" with non-zero rpnl means the position was fully squared off during the day — don't filter these out if you're computing realized P&L.
  • urmtom (unrealized MTM) only reflects open positions; combine with rpnl for total day P&L.

Python example

python
positions = api.get_positions()
for p in positions:
    print(p['tsym'], p['netqty'], p['rpnl'])

Notes

Field names are abbreviated per the Noren protocol (rpnl = realized P&L, urmtom = unrealized MTM, cf = carry-forward). Use Product Conversion to move a position between intraday and delivery products without squaring off and re-entering.