On this page
What this endpoint does

What you are currently holding from trading -- how much, at what average price, and whether you are up or down.

POSThttps://api.infinn.in/NorenWClientAPI/PositionBook
Method
POST
Authentication
Token required
Content-Type
text/plain
Body
jData=<json>
Returns
JSON array
Rate limit
20 orders/sec, 200/min (account-wide)

What it does

What you are currently holding from trading -- how much, at what average price, and whether you are up or down.

Returns today's open positions with profit and loss.

Never poll this in a loop

The API specification is explicit: use this as a single call to seed your state, not in a while loop. For live mark-to-market, take prices from the WebSocket feed and recompute locally.

MTM and P&L are not the same number

Both use the same unrealised formula but a different average price: MTM uses netavgprc, while P&L uses netupldprc (falling back to netavgprc when it is 0). The full documented arithmetic is on the profit and loss page.

prarr appears where prd is documented

The published sample contains "prarr": "C" where the field table documents prd. Handle both keys.

Request

Send a POST with the header Content-Type: text/plain. The body is a single form field, jData, whose value is a JSON string. Include Authorization: Bearer <access_token>. See how requests are shaped if that sounds unfamiliar.

Headers

Request headers
HeaderTypeDescription
Authorization
required
string

Bearer <access_token>, using the access_token from GenAcsTok. A missing or rejected token returns an HTTP error (usually 403) with an empty body.

Content-Type
required
string

text/plain (used in these docs) or application/json. Both work. The body is always jData=<JSON>.

jData fields

Request parameters
FieldTypeDescription
uid
required
string

Logged-in user ID.

Your Infinn login ID - the same one you type at trade.infinn.in.

ExampleIN001
Where to get itThe ID you log in with at trade.infinn.in. Also returned as uid by GenAcsTok.
actid
required
string

Account ID of the logged-in user.

Your trading account number. For an individual account this is the same as your user ID.

ExampleIN001
Where to get itReturned as actid by GenAcsTok and UserDetails. Same as the user ID for individual accounts.

Request and response together

The same call, shown as raw HTTP on the left and the documented response on the right.

Request
HTTP request
POST /NorenWClientAPI/PositionBook HTTP/1.1
Host: api.infinn.in
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: text/plain

jData={"uid":"IN001","actid":"IN001"}
Response
200 OK
[
{
  "stat": "Ok",
  "uid": "IN001",
  "actid": "IN001",
  "exch": "NSE",
  "tsym": "ACC-EQ",
  "pp": "2",
  "ls": "1",
  "ti": "5.00",
  "mult": "1",
  "prcftr": "1.000000",
  "daybuyqty": "2",
  "daysellqty": "2",
  "daybuyamt": "2610.00",
  "daybuyavgprc": "1305.00",
  "daysellamt": "2610.00",
  "daysellavgprc": "1305.00",
  "cfbuyqty": "0",
  "cfsellqty": "0",
  "openbuyqty": "0",
  "opensellqty": "23",
  "opensellamt": "30015.00",
  "opensellavgprc": "1305.00",
  "netqty": "0",
  "netavgprc": "0.00",
  "lp": "0.00",
  "urmtom": "0.00",
  "rpnl": "0.00",
  "cforgavgprc": "0.00"
}
]

A failure, for comparison

Note the HTTP status: it is still 200. The failure is reported inside the body. See the two error layers.

Request
HTTP request
POST /NorenWClientAPI/PositionBook HTTP/1.1
Host: api.infinn.in
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: text/plain

jData={"uid":"IN001","actid":"IN001"}
Error
200 OK — but stat is Not_Ok
{
"stat": "Not_Ok",
"request_time": "14:14:11 26-05-2020",
"emsg": "Error Occurred : 5 \"no data\""
}

Code examples

Each sample is a complete, runnable program. Replace YOUR_ACCESS_TOKEN and the placeholder field values, and it will run as-is. Every one checks both error layers.

cURL
curl --request POST \
--url 'https://api.infinn.in/NorenWClientAPI/PositionBook' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'Content-Type: text/plain' \
--data 'jData={"uid":"IN001","actid":"IN001"}'

Response

On success the body is a JSON array of objects. Infinn omits fields rather than returning null, so check that a field is present before reading it.

Response fields
FieldTypeDescription
statstring

Ok on success, Not_Ok on failure. Always check this before reading anything else.

Did it work? Ok means yes, Not_Ok means no.

exchstring

Exchange segment.

tsymstring

Trading symbol.

tokenstring

Contract token.

uidstring

User ID.

actidstring

Account ID.

prdstring

Product.

s_prdt_alistring

Product display name.

netqtystring

Net position quantity. Positive is long, negative is short.

How many you are holding. A minus sign means you are short.

netavgprcstring

Net position average price.

dayavgprcstring

Day average price.

daybuyqtystring

Quantity bought today.

daysellqtystring

Quantity sold today.

daybuyavgprcstring

Average buy price today.

daysellavgprcstring

Average sell price today.

daybuyamtstring

Value bought today.

daysellamtstring

Value sold today.

cfbuyqtystring

Carry-forward buy quantity.

cfsellqtystring

Carry-forward sell quantity.

cfbuyavgprcstring

Carry-forward buy average price.

cfsellavgprcstring

Carry-forward sell average price.

cfbuyamtstring

Carry-forward buy value.

cfsellamtstring

Carry-forward sell value.

cforgavgprcstring

Original average price.

totbuyamtstring

Total buy value.

totsellamtstring

Total sell value.

totbuyavgprcstring

Total buy average price.

totsellavgprcstring

Total sell average price.

openbuyqtystring

Open buy quantity.

opensellqtystring

Open sell quantity.

openbuyamtstring

Open buy value.

opensellamtstring

Open sell value.

openbuyavgprcstring

Open buy average price.

opensellavgprcstring

Open sell average price.

lpstring

Last traded price.

rpnlstring

Realised profit and loss.

Profit you have already locked in by closing part of the position.

urmtomstring

Unrealised mark-to-market. Recompute on each price tick as netqty * (lp - netavgprc) * prcftr.

Profit or loss on what you are still holding, at the current price.

bepstring

Break-even price.

multstring

Contract price multiplier, used for order-value maths.

prcftrstring

Price factor, gnpn / (gdpd).

ppstring

Price precision.

tistring

Tick size.

lsstring

Lot size.

instnamestring

Instrument name.

upldprcstring

Upload price.

netupldprcstring

Net upload price.

dnamestring

Broker-specific display name.

cnamestring

Company name.

request_timestring

The time Infinn processed the request, formatted HH:MM:SS dd-mm-yyyy.

PresencePresent on success.
emsgstring

Human-readable reason for the failure.

If something went wrong, this says what.

PresencePresent only when stat is Not_Ok.

Errors

This endpoint can fail at either layer. A transport failure returns a 4xx or 5xx with an empty body; an application failure returns 200 with stat: "Not_Ok" and an emsg.

Esc
↑↓ navigate↵ openEsc close/ to search