Skip to content

Order Book

When an order is placed, the status of the order can be viewed in the order book (Open, Executed, canceled, rejected)

POST: /api/orderBook

https://connect.thefirstock.com/api/orderBook

Request Details

Parameter Description
userId User Id of the login user
jKey Key Obtained on login success.
exchange NSE / NFO / BSE

Code

from thefirstock import thefirstock

oB = thefirstock.firstock_orderBook()
curl -X POST 'https://connect.thefirstock.com/api/orderBook' \
     -H 'Content-Type: application/json' \
     -d '{
          "userId": "",
          "actid": "",
        }'
const Firstock = require('thefirstock');

const firstock = new Firstock();

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

Response Details

Parameter Description
stat Ok or Not_Ok Order book success or failure indication.
exch Exchange Segment
tsym Trading symbol / contract on which order is placed.
norenordno Noren Order Number
qty Order Quantity
prd Display product alias name, using prarr returned in user details.
trantype B / S trantype B / S Transaction type of the order
prctyp LMT / MKT
Price type
fillshares Total Traded Quantity of this order
avgprc Average trade price of total traded quantity
exchordid Exchange Order Number
remarks Any message Entered during order entry.
ret DAY / IOC / EOS Order validity
uid
actid
pp Price precision
ti Tick size
ls Lot size
cstFrm Custom Firm
fltm Fill Time
flid Fill ID
flqty Fill Qty
flprc Fill Price
orderSource Order Source
token Token
flqty Fill Qty
flprc Fill Price(present only when reporttype is Fill)
rprc
orderStatus
rqty
Response data will be in json format with below fields in case of failure:
Parameter Description
stat Ok or Not_Ok Place order success or failure indication
requestTime Response received time.
emsg Error message

Sample Response

{
"status":"Ok",
"norenordno":"22052800000038",
"userId":"PP1583","actid":"PP1583",
"exchange":"NSE",
"tradingSymbol":"ITC-EQ",
"quantity":"10",
"ordenttm":"1653848104",
"transactionType":"B",
"priceType":"LMT",
"retention":"DAY",
"token":"1660",
"mult":"1",
"prcftr":"1.000000",
"pp":"2",
"ls":"1",
"ti":"0.05",
"price":"240.00",
"rprc":"0.00",
"dscqty":"0",
"product":"C",
"orderStatus":"REJECTED",
"norentm":"23:45:04 29-05-2022",
"rqty":"0",
"rejreason":"RED:RULE:{Check circuit limit including square off order}Current:INR 240.00 LowerCircuit:INR 242.30 UpperCircuit:INR 296.10:NSE.ITC-EQ for C-PP1583 [ONLINE]"},{"status":"Ok","norenordno":"22052800000037","userId":"PP1583","actid":"PP1583","exchange":"NSE","tradingSymbol":"ITC-EQ","quantity":"10","ordenttm":"1653847407","transactionType":"B","priceType":"LMT","retention":"DAY","token":"1660","mult":"1","prcftr":"1.000000","pp":"2","ls":"1","ti":"0.05","price":"240.00","rprc":"0.00","dscqty":"0","product":"C","orderStatus":"REJECTED","norentm":"23:33:27 29-05-2022","rqty":"0","rejreason":"RED:RULE:{Check circuit limit including square off order}Current:INR 240.00 LowerCircuit:INR 242.30 UpperCircuit:INR 296.10:NSE.ITC-EQ for C-PP1583 [ONLINE]"},{"status":"Ok","norenordno":"22052800000003","userId":"PP1583","actid":"PP1583","exchange":"NSE","tradingSymbol":"ITC-EQ","quantity":"10","ordenttm":"1653727126","transactionType":"B","priceType":"LMT","retention":"DAY","token":"1660","mult":"1","prcftr":"1.000000","pp":"2","ls":"1","ti":"0.05","price":"240.00","rprc":"0.00","dscqty":"0","product":"C","orderStatus":"REJECTED","norentm":"14:08:46 28-05-2022","rqty":"0","rejreason":"RED:RULE:{Check circuit limit including square off order}Current:INR 240.00 LowerCircuit:INR 242.30 UpperCircuit:INR 296.10:NSE.ITC-EQ for C-PP1583 [ONLINE]"
}
{
"stat":"Not_Ok",
"emsg":"Session Expired : Invalid Session Key"
}