Positions Book
/NorenWClientAPI/PositionBookAuthorization token is required. Enter your access_token from GenAcsTok above.
"Use proxy" sends this request through this website's server, which never logs request or response bodies. Infinn sees the docs server's IP, not yours. Turn it off to send directly from your browser instead.
jData fields
Values are sent as a JSON string in the jData form field.
Logged in User Id
- Example:
YOUR_USER_ID - Where to get it: The ID you log in with at trade.infinn.in (User ID = Client ID). Also returned as uid by GenAcsTok.
Account Id of logged in user
- Example:
YOUR_USER_ID - Where to get it: Same as User ID for individual accounts. Returned by GenAcsTok / UserDetails.
Authorization Token
Required for all API calls. Use the access_token from the GenAcsTok response as a Bearer token.
⚠ When "Use proxy" is on, this token is sent through this website's server on its way to Infinn. It is never logged here, but if you would rather it never leave your browser, turn off "Use proxy" above or use the ready code with your own client instead.
Request to be POSTed to url : /NorenWClientAPI/PositionBook
Request Details
| Parameter Name | Possible value | Description |
|---|---|---|
| jData* | Should send json object with fields in below list | |
| Authorization* | Bearer <access_token> | access_token from GenAcsTok response. Required for all API calls. |
| Json Fields | Possible value | Description |
|---|---|---|
| uid* | Logged in User Id | |
| actid* | Account Id of logged in user |
Example
curl https://apitest.kambala.co.in/NorenWClientAPI/PositionBook \
-d "jData={\"uid\":\"VIDYA\", \"actid\":\"ACCT_1\"}" \
-d "jKey=GHUDWU53H32MTHPA536Q32WR"Response Details
Response data will be in json format with Array of Objects with below fields in case of success:
| Json Fields | Possible value | Description |
|---|---|---|
| stat | Ok or Not_Ok | Position book success or failure indication. |
| exch | Exchange segment | |
| tsym | Trading symbol / contract. | |
| token | Contract token | |
| uid | User Id | |
| actid | Account Id | |
| prd | Product name to be shown. | |
| s_prdt_ali | Product display name | |
| netqty | Net Position quantity | |
| netavgprc | Net position average price | |
| dayavgprc | Day average price | |
| daybuyqty | Day Buy Quantity | |
| daysellqty | Day Sell Quantity | |
| daybuyavgprc | Day Buy average price | |
| daysellavgprc | Day buy average price | |
| daybuyamt | Day Buy Amount | |
| daysellamt | Day Sell Amount | |
| cfbuyqty | Carry Forward Buy Quantity | |
| cforgavgprc | Original Avg Price | |
| cfsellqty | Carry Forward Sell Quantity | |
| cfbuyavgprc | Carry Forward Buy average price | |
| cfsellavgprc | Carry Forward Buy average price | |
| cfbuyamt | Carry Forward Buy Amount | |
| cfsellamt | Carry Forward Sell Amount | |
| totbuyamt | Total Buy Amount | |
| totsellamt | Total Sell Amount | |
| totbuyavgprc | Total Buy Avg Price | |
| totsellavgprc | Total Sell Avg Price | |
| lp | LTP | |
| rpnl | RealizedPNL | |
| urmtom | UnrealizedMTOM. Can be recalculated in LTP update = netqty * (lp from web socket - netavgprc) * prcftr | |
| bep | Break even price | |
| openbuyqty | Open Buy Quantity | |
| opensellqty | Open Sell Quantity | |
| openbuyamt | Open Buy Amount | |
| opensellamt | Open Sell Amount | |
| openbuyavgprc | Open Buy Average Price | |
| opensellavgprc | Open Sell Average Price | |
| mult | Contract price multiplier, (used for order value calculation) | |
| pp | Price precision | |
| prcftr | gnpn/(gdpd). | |
| ti | Tick size | |
| ls | Lot size | |
| instname | Instrument Name | |
| upldprc | Upload price | |
| netupldprc | Net Upload Price | |
| dname | Broker specific contract display name, present only if applicable. | |
| cname | Company Name. | |
| request_time | This will be present only in a failure response. |
Note: Calculation of MTM and PnL
-
ActualUnrealizedMtoM = netqty(in weights) * prcftr * mult * (LTP - avgprc)
- For MTM, avgprc = netavgprc
- For PnL, avgprc = netupldprc; if netupldprc = 0 then avgprc = netavgprc
-
NetBuyQty = daybuyqty + cfbuyqty
-
NetSellQty = daysellqty + cfsellqty
-
ActualSellAvgPrice
- if (NetSellQty != 0):
ActualSellAvgPrice = ((daysellamt / mult) + (upldprc * prcftr * cfsellqty)) / NetSellQty - else:
ActualSellAvgPrice = 0.0
- if (NetSellQty != 0):
-
ActualBuyAvgPrice
- if (NetBuyQty != 0):
ActualBuyAvgPrice = ((daybuyamt / mult) + (upldprc * prcftr * cfbuyqty)) / NetBuyQty - else:
ActualBuyAvgPrice = 0.0
- if (NetBuyQty != 0):
-
ActualBookedPNL
- if (netqty(in weights) > 0):
ActualBookedPNL = (ActualSellAvgPrice - ActualBuyAvgPrice) * NetSellQty * mult - else:
ActualBookedPNL = (ActualSellAvgPrice - ActualBuyAvgPrice) * NetBuyQty * mult
- if (netqty(in weights) > 0):
-
MTM = rpnl + ActualUnrealizedMtoM
-
PnL = ActualBookedPNL + ActualUnrealizedMtoM
Sample Success Response
[
{
"stat":"Ok",
"uid":"POORNA",
"actid":"POORNA",
"exch":"NSE",
"tsym":"ACC-EQ",
"prarr":"C",
"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",
"cfbuyamt":"0.00",
"cfbuyavgprc":"0.00",
"cfsellamt":"0.00",
"cfsellavgprc":"0.00",
"openbuyqty":"0",
"opensellqty":"23",
"openbuyamt":"0.00",
"openbuyavgprc":"0.00",
"opensellamt":"30015.00",
"opensellavgprc":"1305.00",
"netqty":"0",
"netavgprc":"0.00",
"lp":"0.00",
"urmtom":"0.00",
"rpnl":"0.00",
"cforgavgprc":"0.00"
}
]Sample Failure Response
{
"stat":"Not_Ok",
"request_time":"14:14:11 26-05-2020",
"emsg":"Error Occurred : 5 \"no data\""
}curl --request POST \
--url 'https://api.infinn.in/NorenWClientAPI/PositionBook' \
--header 'Authorization: Bearer PASTE_ACCESS_TOKEN_HERE' \
--header 'Content-Type: text/plain' \
--data 'jData={"uid":"YOUR_USER_ID","actid":"YOUR_USER_ID"}'