Skip to main content

Order & Report

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/V4/positionBook

Request details

API Parameters
Parameter Description Example
userId
string
Identifier for the user upon login, unique
to each user in the system.
AA0013
jKey
string
Authentication key obtained after
successful login
d9b4e1b1c79042476

Libraries and SDKs

Tabbed Interface
from thefirstock import thefirstock

positionBook = thefirstock.firstock_PositionBook(userId="{{userId}}")
curl --location --request POST 'https://connect.thefirstock.com/api/V4/positionBook' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jKey": "{{jKey}}",
    "userId": "{{userID}}"
}''
const Firstock = require("thefirstock");

const firstock = new Firstock();

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

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

Success response details

API Parameters
{
  "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"
  }
}

Failure response details

API Error Parameters
Parameter Description Example
status
String
Indicates the outcome of the operation. success
data.userID
String
User Id of the logged-in
user. This is a unique identifier for
each user.
AA0011
data.exchange
String
Exchange on which the order is placed
(e.g., NSE, BSE, NFO, BFO)
NSE
data.tradingSymbol
String
Encoded trading symbol of the security ITC-EQ
data.product
String
Product code indicating the type of trade
C -> Cash and Carry,
M -> F&O Normal,
I -> Intraday
I
data.token
String
The unique token associated with the
specified trading symbol.
1660
data.pricePrecision
String
The level of precision used in pricing. 2
data.RealizedPNL
String
Realized Profit and Loss.
Shows the profit or loss that has
been realized from closed positions.
7.85
data.unrealizedMTOM
String
Unrealized Mark-To-Market (MTOM).
Reflects the current unrealized profit
or loss on open positions,
based on current market prices.
0.00
data.priceFactor
String
A factor used to adjust the
pricing of a security or contract,
often used in derivative markets.
1.000000
data.lotSize
String
The standard number of units in one lot. 1
data.tickSize
String
The minimum price movement in the
trading instrument.
0.05
data.mult
String
Multiplier used in pricing or
quantity calculations, can scale up or
down the value of a trade or contract.
1
data.netUploadPrice
String
The average price of securities
uploaded along with holdings,
typically used for accounting
or portfolio tracking.
0.00
data.dayBuyQuantity
String
The total quantity of the
security bought on the current day,
representing the day's buying volume.
4
data.daySellQuantity
String
The total quantity of the
security sold on the current day,
showing how much of the security was
offloaded.
4
data.dayBuyAveragePrice
String
The average price at which
the security was bought during the
day, calculated based on the total
amount spent and the number
of securities bought.
326.48
data.daySellAveragePrice
String
The average price at which
the security was sold during the day,
reflecting the average revenue per
unit from selling the security.
326.48
data.dayBuyAmount
String
The total amount spent on
buying the security during the day,
the product of the day buy quantity
and the average buy price.
1305.90
data.netQuantity
String
Net Position Quantity. Shows
the net holding in the security,
considering both buys and sells.
0
data.netAveragePrice
String
Net Position Average Price. Indicates the
average price of the net position held
in the security.
0.00
data.uploadPrice
String
Represents the average price of securities
when uploaded into the system, particularly
relevant for holdings transferred from another
account or platform.
0.00
Parameter Description Example
status
String
Indicates the result status of the
API operation
failed
code
String
HTTP status code associated with the error 404
name
String
Specifies the type or category of the error
encountered
ORDERS_NOT_FOUND
error.field
String
Field in the request that triggered the error orderDetails
error.message
String
Detailed message describing the error No data on the orders was found
{
  "status": "failed",
  "code": "404",
  "name": "ORDERS_NOT_FOUND",
  "error": {
      "field": "orderDetails",
      "message": "No data on the orders was found"
  }
}