Skip to content

Positions Book

The positions book contains the user's portfolio of short to medium-term derivatives (futures and options contracts) and intraday equity stocks. Instruments in the position’s portfolio remain there until they're sold, or until expiry. Equity positions carried overnight moves to the holding’s portfolio the next day.

POST: /api/positionBook

https://connect.thefirstock.com/api/positionBook

Request Details

Parameter Description
userId User Id of the login user
jKey Key Obtained on login success.
actid Account id of the logged in user.

Code

from thefirstock import thefirstock

PB= thefirstock.firstock_PositionBook()
curl -X POST 'https://connect.thefirstock.com/api/positionBook' \
-H 'Content-Type: application/json' \
-d '{
    "userId": "",
    "jKey": "",
    "actid": ""
}'
const Firstock = require('thefirstock');

const firstock = new Firstock();

firstock.positionsBook((err, result)=>{
    console.log("Error, ",err)
    console.log("Result: ",result)
})
using thefirstock;

class Program
{
public static void Main()
{
    Firstock firstock = new Firstock();
    var result = firstock.positionBook();
}
}

Response Details

Response data will be in json Array of objects with below fields in case of success.

Parameter 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.
lp LTP
rpnl RealizedPN
urmtom UnrealizedMTOM.(Can be recalculated in LTP update : = netqty * (lp from web socket - netavgprc) * prcftr
bep Break even price
openbuyqty
opensellqty
mult
pp
prcftr gnpn/(gdpd).
ti Tick size
ls Lot size
requestTime This will be present only in a failure response.
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
netqty Net Position quantity
netavgprc Net position average price
upldprc Average price uploaded along with holdings
dname
netupldprc

Response data will be in json format with below fields in case of failure:

Parameter Description
stat Ok or Not_Ok Place order success or failure indication
requestTime Response received time.
emsg Error message

Sample Response

{
"stat":"Ok",
"uid":"PP1583",
"actid":"PP1583",
"exch":"NFO",
"tsym":"NIFTY02JUN22P16200",
"prd":"M",
"token":"55662",
"dname":"NIFTY 02JUN22 16200 PE ",
"pp":"2",
"ls":"50",
"ti":"0.05",
"mult":"1",
"prcftr":"1.000000",
"daybuyqty":"0",
"daysellqty":"500",
"daybuyamt":"0.00",
"daybuyavgprc":"0.00",
"daysellamt":"14625.00",
"daysellavgprc":"29.25",
"cfbuyqty":"0",
"cfsellqty":"0",
"dayavgprc":"29.25",
"netqty":"-500",
"netavgprc":"29.25",
"upldprc":"0.00",
"netupldprc":"29.25",
"lp":"20.00",
"urmtom":"4625.00",
"bep":"29.25",
"rpnl":"0.00"
},
{
"stat":"Ok",
"uid":"PP1583",
"actid":"PP1583",
"exch":"NFO",
"tsym":"NIFTY02JUN22P16500",
"prd":"M",
"token":"55686",
"dname":"NIFTY 02JUN22 16500 PE ",
"pp":"2",
"ls":"50",
"ti":"0.05",
"mult":"1",
"prcftr":"1.000000",
"daybuyqty":"500",
"daysellqty":"0",
"daybuyamt":"52290.00",
"daybuyavgprc":"104.58",
"daysellamt":"0.00",
"daysellavgprc":"0.00",
"cfbuyqty":"0",
"cfsellqty":"0",
"dayavgprc":"104.58",
"netqty":"500",
"netavgprc":"104.58",
"upldprc":"0.00",
"netupldprc":"104.58",
"lp":"81.50",
"urmtom":"-11540.00",
"bep":"104.58",
"rpnl":"-0.00"
},
{
"stat":"Ok",
"uid":"PP1583",
"actid":"PP1583",
"exch":"NFO",
"tsym":"BANKNIFTY02JUN22P35500",
"prd":"M",
"token":"48833",
"dname":"BANKNIFTY 02JUN22 35500 PE ",
"pp":"2",
"ls":"25",
"ti":"0.05",
"mult":"1",
"prcftr":"1.000000",
"daybuyqty":"100",
"daysellqty":"100",
"daybuyamt":"26992.50",
"daybuyavgprc":"269.93",
"daysellamt":"27767.50",
"daysellavgprc":"277.68",
"cfbuyqty":"0",
"cfsellqty":"0",
"dayavgprc":"0.00",
"netqty":"0",
"netavgprc":"0.00",
"upldprc":"0.00",
"netupldprc":"0.00",
"lp":"368.05",
"urmtom":"0.00",
"rpnl":"775.00"
}  
{
"stat":"Not_Ok",
"request_time":"16:01:48 28-05-2020",
"emsg": "Error Occurred : 5 \"no data\""    }