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: /apiV2/positionBook
https://connect.thefirstock.com/apiV2/positionBook
Request Details
Parameter | Description |
---|---|
userId | User Id of the login user |
jKey | Key Obtained on login success. |
Code
curl -X POST 'https://connect.thefirstock.com/apiV2/positionBook' \
-H 'Content-Type: application/json' \
-d '{
"userId": "",
"jKey": "",
}'
from thefirstock import thefirstock
PB= thefirstock.firstock_PositionBook()
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 |
---|---|
data.requestTime | Response received time. |
Status | Success |
data.tradingSymbol | Trading symbol / contract. |
data.token | Contract token |
data.userId | User Id |
data.product | Product name to be shown. |
data.RealizedPNL | RealizedPN |
data.unrealizedMTOM | UnrealizedMTOM.(Can be recalculated in LTP update : = netqty * (lp from web socket - netavgprc) * prcftr |
data.priceFactor | gnpn/(gdpd). |
data.tickSize | Tick size |
data.lotSize | Lot size |
data.requestTime | This will be present only in a failure response. |
data.dayBuyQuantity | Day Buy Quantity |
data.daySellQuantity | Day Sell Quantity |
data.dayBuyAveragePrice | Day Buy average price |
data.daySellAveragePrice | Day buy average price |
data.dayBuyAmount | Day Buy Amount |
data.daysellamt | Day Sell Amount |
data.netQuantity | Net Position quantity |
data.netAveragePrice | Net position average price |
data.uploadPrice | Average price uploaded along with holdings |
Response data will be in json format with below fields in case of failure:
Parameter | Description |
---|---|
Status | Failed |
data | Type of error |
requestTime | Response received time. |
Sample Response
{
"Status": "Success",
"data": {
"userId": "",
"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"
}
]
}
{
"Status": "Failed",
"data": "Error Occurred : 5 \"no data\"",
"requestTime": ""
}