Skip to main content

Order & Report

Trade Book

When an order is actually executed on the exchange within the stipulated conditions, the actual execution status along with the trade number gets reflected in the Trade Book in your online account.

It furnishes a comprehensive rundown of the completed trades for the ongoing trading day

Method: POST

https://connect.thefirstock.com/api/V4/tradeBook

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 token obtained from
the login API
d9b4e1b1c790424

Libraries and SDKs

Tabbed Interface
from thefirstock import thefirstock

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

const firstock = new Firstock();

firstock.tradeBook(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.tradeBook();
    }
}

Success response details

API Parameters
Parameter Description Example
status
String
Indicates the outcome of the
API request
success
data.userID
String
User Id of the logged-in user AA0013
data.exchange
String
Exchange on which the order is placed
(e.g., NSE, BSE, NFO, BFO)
NFO
data.priceType
String
Type of order pricing
(e.g., LMT / MKT / SL-LMT / SL-MKT)
MKT
data.retention
String
Specifies the order's validity period,
such as DAY, IOC (Immediate or Cancel),
or EOS (End of Session).
DAY
data.product
String
Product code indicating the type of trade
C -> Cash and Carry,
M -> F&O Normal,
I -> Intraday
I
data.fillId
String
A unique identifier for a specific order
fill.
607999000
data.fillTime
String
The exact time when the order was filled. "17-02-2023 14:15:50"
data.transactionType
String
Transaction type, either Buy (B) or Sell (S) B
data.tradingSymbol
String
Encoded trading symbol of the security NIFTY23FEB23P40000
data.quantity
String
The number of units involved in the order. 25
data.token
String
The unique token associated with the
specified trading symbol.
57828
data.fillshares
String
Total number of shares or units traded
in this specific order.
Example: "25" indicates the total
traded quantity for the order.
25
data.pricePrecision
String
The level of precision used in pricing.
Example: "2" could indicate two
decimal places in pricing.
2
data.lotSize
String
The standard number of units in
one lot. Example: "25" could be the number of
units in one standard lot.
1
data.tickSize
String
The minimum price movement in the
trading instrument.
0.05
data.fillPrice
String
The price at which the order was filled. 63.65
data.fillQuantity
String
The quantity of the asset that was filled. 25
data.exchordid
String
The order number assigned by the exchange. 189654321235
data.orderNumber
String
A unique identifier for the order. 1234567890111
data.priceFactor
String
A factor used in pricing calculations. 1.000000
data.orderTime
String
The exact time when the order was placed. 14:15:50 7-02-2023
data.fillPrice
String
Repeats the fill price of the order. 63.65
data.exchangeUpdateTime
String
Update time of exchange 17-02-2023 14:15:50
{  
  "status": "success",  
    "data": [    
    {    
      "orderNumber": "1234567890111",    
      "userId": "AA0011",      
      "exchange": "NFO",  
      "tradingSymbol": "BANKNIFTY23FEB23P40000", 
      "quantity": "25",    
      "transactionType": "B", 
      "priceType": "MKT",      
      "retention": "DAY",  
      "token": "57828",    
      "priceFactor": "1.000000",   
      "pricePrecision": "2",    
      "lotSize": "25",     
      "tickSize": "0.05",     
      "product": "I",    
      "orderTime": "14:15:50 17-02-2023",    
      "fillId": "607999000",       
      "fillTime": "17-02-2023 14:15:50",   
      "fillshares": "25",      
      "fillQuantity": "25",     
      "fillPrice": "63.65",   
      "exchordid": "189654321235",  
      "exchangeUpdateTime": "17-02-2023 14:15:50"  
    },  
  ]
}

Failure response details

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