Skip to main content

Position book

A trading or position book is an up-to-date record of a trader's open positions.

The Position Book holds the user's collection of short-term to medium-term derivative instruments such as futures and options contracts, as well as intraday equity stocks. These instruments remain within the portfolio until they are sold or reach their expiration date.Any equity positions that are held overnight will be transferred to the Holding Portfolio the following day.

Method: POST

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

Request details

ParameterDescriptionData typesExample
userIdUser Id of the login userString"AA1999"
jKeyKey Obtained on login success.String"d9b4e1b1c79042476fd96
11eed81003b2dc34c3f13b
0b60a4842fd5a24c9f3f2"
curl --location 'https://connect.thefirstock.com/api/V3/positionBook' \
--header 'Content-Type: application/json' \
--data '{
"userId": "AA123",
"jKey": "e6a211bea63adff386578988e1cf4a9521c4744e6a39ad63174c8797e2af8c38"
}'

Response details

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

ParameterDescriptionData typesExamples
statusSuccessString"Success"
data.userIdUser IdString"AA0011"
data.exchangeExchange SegmentString"NSE"
data.tradingSymbolTrading symbol / contract.String"ITC-EQ"
data.productProduct name to be shown.String"I"
data.tokenContract tokenString"1660"
data.pricePrecisionPrice precisionString"2"
data.RealizedPNLRealizedPNString"7.85"
data.unrealizedMTOMUnrealizedMTOM.(Can be recalculated in LTP update : = netqty * (lp from web socket - netavgprc) * prcftrString"0.00"
data.priceFactorpriceFactorString "1.000000"
data.lotSizelotSizeString"1"
data.tickSizetickSizeString"0.05"
data.multMultiplierString"1"
data.netUploadPricenetUploadPriceString"0.00"
data.dayBuyQuantityDay Buy QuantityString"4"
data.daySellQuantityDay Sell QuantityString"4"
data.dayBuyAveragePriceDay Buy average priceString"326.48"
data.daySellAveragePriceDay buy average priceString"326.48"
data.dayBuyAmountDay Buy AmountString"1305.90"
data.netQuantityNet Position quantityString"0"
data.netAveragePriceNet position average priceString"0.00"
data.uploadPriceAverage price uploaded along with holdingsString"0.00"

Failure response details

ParameterDescriptionData TypeExample
statusFailedString"Failed"
codeHTTP CodeString"404"
nameType of errorString"ORDERS_NOT_FOUND"
error.fieldError fieldString"orderDetails"
error.messageError messageString"No data on the orders was found"

Sample response

{
"status": "Success",
"data": {
"userId": "AA0011",
"exchange": "NSE",
"tradingSymbol": "ITC-EQ",
"product": "I",
"token": "1660",
"pricePrecision": "2",
"lotSize": "1",
"tickSize": "0.05",
"mult": "1",
"priceFactor": "1.000000",
"dayBuyQuantity": "4",
"daySellQuantity": "4",
"dayBuyAmount": "1305.90",
"dayBuyAveragePrice": "326.48",
"datSellAveragePrice": "328.44",
"netQuantity": "0",
"netAveragePrice": "0.00",
"uploadPrice": "0.00",
"netUploadPrice": "0.00",
"unrealizedMTOM": "0.00",
"RealizedPNL": "7.85"
}
}