Skip to content

Order Book

GET /order/orderBook

Orderbook retrieves and displays details of all orders placed by the user on a specific day. This API returns all states of the orders, namely, open, pending, rejected and executed ones.

Sample Code

bash
curl -X GET 'https://tradeapi.samco.in/order/orderBook' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'x-session-token: <SESSION_TOKEN>'
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Sample {
  public static void main(String[] args) throws Exception {
    HttpClient client = HttpClient.newHttpClient();

    HttpRequest request = HttpRequest.newBuilder()
        .uri(URI.create("https://tradeapi.samco.in/order/orderBook"))
        .header("Content-Type", "application/json")
        .header("Accept", "application/json")
        .header("x-session-token", "<SESSION_TOKEN>")
        .GET()
        .build();

    HttpResponse<String> response =
        client.send(request, HttpResponse.BodyHandlers.ofString());
    System.out.println(response.body());
  }
}
js
(async () => {
  const headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'x-session-token': '<SESSION_TOKEN>',
  };

  const response = await fetch('https://tradeapi.samco.in/order/orderBook', {
    method: 'GET',
    headers,
  });

  const data = await response.json();
  console.log(data);
})();
py
import requests
import json

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'x-session-token': '<SESSION_TOKEN>',
}

r = requests.get('https://tradeapi.samco.in/order/orderBook',
  headers=headers)

print(r.json())

Sample Responses

json
{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Request successful",
  "orderBookDetails": [
    {
      "orderNumber": "191206000000079",
      "exchange": "BSE",
      "tradingSymbol": "RELIANCE",
      "symbolDescription": "RELIANCE INDUSTRIES LTD.",
      "transactionType": "BUY",
      "productCode": "MIS",
      "orderType": "L",
      "orderPrice": "1560.15",
      "quantity": "13",
      "disclosedQuantity": "1",
      "triggerPrice": "1090.00",
      "marketProtection": "3",
      "orderValidity": "DAY",
      "orderStatus": "Complete",
      "orderValue": "20281.95",
      "instrumentName": "NA",
      "orderTime": "06-Dec-2019 13:47:04",
      "userId": "DV99999",
      "filledQuantity": "13",
      "fillPrice": "1560.15",
      "averagePrice": "1560.15",
      "unfilledQuantity": "0",
      "exchangeOrderId": "1575608622401000995",
      "rejectionReason": "NA",
      "exchangeConfirmationTime": "06-Dec-2019 14:14:47",
      "cancelledQuantity": "0",
      "referenceLimitPrice": "0.00",
      "coverOrderPercentage": "0.00",
      "orderRemarks": "--",
      "exchangeOrderNumber": "1575608622401000995",
      "symbol": "52310_NFO",
      "displayStrikePrice": "0.00",
      "displayNetQuantity": "10",
      "status": "complete",
      "exchangeStatus": "complete",
      "expiry": "--",
      "pendingQuantity": "0",
      "instrument": "--",
      "scripName": "--",
      "totalQuanity": "13",
      "optionType": "--",
      "orderPlaceBy": "DV99999",
      "lotQuantity": "1",
      "parentOrderId": "200824000050316"
    }
  ]
}

Response Schema

Status Code 200

NameTypeDescription
serverTimestringTime at Server.
msgIdstringThis is a unique identifier for every request into the system. Please quote this identifier to the support team if you face issues with the API request.
statusstringResponse status. Can be Success or Failure.
statusMessagestringStatus message.
orderBookDetails[object]List of all orders with details during the day.
orderNumberstringUnique Order identifier generated after placing an order.
exchangestringName of the exchange. Valid exchange values are BSE, NSE, NFO, MCX, and CDS. If not provided, the default is NSE. For trading with BSE, NFO, CDS, and MCX, the exchange is mandatory.
tradingSymbolstringTrading Symbol of the scrip.
symbolDescriptionstringScrip description.
transactionTypestringType of the transaction, BUY / SELL.
productCodestringProduct Type of order as placed by the user. It can be CNC (Cash and Carry), BO (Bracket Order), CO (Cover Order), NRML (Normal), or MIS (Intraday).
orderTypestringType of order the user has placed. It can be one of the following: MKT (Market Order), L (Limit Order), SL (Stop Loss Limit), SL-M (Stop Loss Market).
orderPricestringTotal price of a particular order.
quantitystringTotal quantity as placed by the user.
disclosedQuantitystringIf provided, should be a minimum of 10% of the actual quantity.
triggerPricestringThe price at which an order should be triggered in the case of SL, SL-M.
marketProtectionstringPercentage of market protection required for order type MKT/SL-M to limit loss due to market price changes against the price with which the order is placed. Default value is 3%.
orderValiditystringOrder validity can be DAY / IOC.
orderStatusstringStatus of the order at the Exchange side, either executed successfully, pending, or rejected.
orderValuestringValue of the order.
instrumentNamestringName of the instrument.
orderTimestringOrder placement time.
userIdstringThe client code provided to you by SAMCO after opening an account.
filledQuantitystringQuantity filled in a specific trade. Can be less than or equal to the total quantity.
fillPricestringPrice at which the exchange has filled the order.
averagePricestringAverage trading price of the equity.
unfilledQuantitystringQuantity which is not filled in a partially filled order. Can be less than or equal to the total quantity.
exchangeOrderIdstringUnique Order identifier generated from the exchange.
rejectionReasonstringIf the order is rejected, cause of order rejection.
exchangeConfirmationTimestringOrder confirmation time at the exchange.
cancelledQuantitystringCancelled quantity for partially cancelled orders.
referenceLimitPricestringLimit price reference.
coverOrderPercentagestringPercentage of cover order.
orderRemarksstringRemarks about the order.
exchangeOrderNumberstringUnique Order identifier generated after placing an order.
symbolstringSymbol about the stock.
displayStrikePricestringShows the strike price.
displayNetQuantitystringDisplays the limit quantity of the order.
statusstringStatus will display Executed/Pending/Rejected.
exchangeStatusstringExchange status will display Executed/Pending/Rejected.
expirystringShows expiry date of the stock.
pendingQuantitystringPending quantity will show the pending quantity of stock.
instrumentstringInstrument is about the type of stock. FUT/OPT.
scripNamestringName of the scrip.
totalQuantitystringTotal quantity.
optionTypestringOption type (PE/CE).
orderPlacedBystringClient code of the user who placed the order.
lotQuantitystringLot quantity represents the number of contracts contained in one derivative security. Applicable for F&O.
parentOrderIdstringOrder ID of the parent order (applicable for only BO/CO orders).