Order Book
An order book is a list of transactions, whether they are to buy or sell stocks, futures or options.
Order status can be monitored and updated in the order book, which displays the current status of each order as Open, Executed, Canceled, or Rejected.
Method: POST
https://connect.thefirstock.com/api/V4/orderBook
Request details
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 |
be1ab734ae55aed00d2b730bb59213 |
Libraries and SDKs
from thefirstock import thefirstock
orderBook = thefirstock.firstock_orderBook(userId="{{userId}}")
curl --location --request POST 'https://connect.thefirstock.com/api/V4/orderBook' \
--header 'Content-Type: application/json' \
--data-raw '{
"jKey": "{{jKey}}",
"userId": "{{userId}}"
}'<
const Firstock = require("thefirstock");
const firstock = new Firstock();
firstock.orderBook(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.orderBook();
}
}
Success response details
Parameter | Description | Example |
---|---|---|
status string |
Status of the API request, indicating whether it was successful or not. |
success |
data.userId string |
User ID associated with the logged-in user. | AA0013 |
data.orderNumber string |
Unique identifier for the order, provided upon successful placement |
123456789 |
data.exchange string |
Exchange on which the order is placed (e.g., NSE, BSE, NFO, BFO) |
NSE |
data.tradingSymbol string |
The trading symbol or contract on which the order is placed. |
ITC-EQ |
data.transactionType string |
Indicates the type of transaction, such as buy (B) or sell (S). |
B |
data.priceType string |
Type of order pricing (e.g., LMT / MKT / SL-LMT / SL-MKT) |
LMT |
data.retention string |
Order validity terms (e.g., DAY / EOS / IOC) |
DAY |
data.token string |
The unique token associated with the specified trading symbol. |
1660 |
data.lotSize string |
Specifies the lot size for the order. | 1 |
data.tickSize string |
The minimum price movement of the trading instrument. |
0.05 |
data.price string |
Price at which the order is to be executed. | 0.00 |
data.product string |
Product code indicating the type of trade C -> Cash and Carry, M -> F&O Normal, I -> Intraday |
M |
data.status string |
Indicates the current status of the order (e.g., SUCCESS, REJECTED, CANCELLED). |
REJECTED |
{
"status": "success",
"data": [
{
"userId": "AA0013",
"orderNumber": "1234567890111",
"exchange": "NSE",
"tradingSymbol": "ITC-EQ",
"quantity": "1",
"transactionType": "B",
"priceType": "LMT",
"retention": "DAY",
"token": "1660",
"lotSize": "1",
"tickSize": "0.05",
"price": "0.00",
"product": "M",
"status": "REJECTED",
"orderTime": "14:19:03 15-02-2023",
"fillShares": "",
"averagePrice": "",
"remarks": "orderbook",
"rejectReason": "ORA:Product Regular not enabled on exchange NSE"
},
{
"userId": "AA199",
"orderNumber": "1234567890111",
"exchange": "NSE",
"tradingSymbol": "ITC-EQ",
"quantity": "1",
"transactionType": "B",
"priceType": "LMT",
"retention": "DAY",
"token": "1660",
"lotSize": "1",
"tickSize": "0.05",
"price": "0.00",
"product": "M",
"status": "REJECTED",
"orderTime": "14:10:13 15-02-2023",
"fillShares": "",
"averagePrice": "",
"remarks": "orderbook",
"rejectReason": "ORA:Product Regular not enabled on exchange NSE"
}
]
}
Failure response details
Parameter | Description | Example |
---|---|---|
status String |
Indicates the result status of the API operation | failed |
code String |
HTTP status code associated with the error | 401 |
name String |
Specifies the type or category of the error encountered |
INVALID_JKEY |
error.field String |
Field in the request that triggered the error | jKey |
error.message String |
Detailed message describing the error | jKey parameter is invalid |
{
"status": "failed",
"code": "401",
"name": "INVALID_JKEY",
"error": {
"field": "jKey",
"message": "jKey parameter is invalid"
}
}