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
| Name | Type | Description |
|---|---|---|
serverTime | string | Time at Server. |
msgId | string | This 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. |
status | string | Response status. Can be Success or Failure. |
statusMessage | string | Status message. |
orderBookDetails | [object] | List of all orders with details during the day. |
orderNumber | string | Unique Order identifier generated after placing an order. |
exchange | string | Name 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. |
tradingSymbol | string | Trading Symbol of the scrip. |
symbolDescription | string | Scrip description. |
transactionType | string | Type of the transaction, BUY / SELL. |
productCode | string | Product 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). |
orderType | string | Type 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). |
orderPrice | string | Total price of a particular order. |
quantity | string | Total quantity as placed by the user. |
disclosedQuantity | string | If provided, should be a minimum of 10% of the actual quantity. |
triggerPrice | string | The price at which an order should be triggered in the case of SL, SL-M. |
marketProtection | string | Percentage 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%. |
orderValidity | string | Order validity can be DAY / IOC. |
orderStatus | string | Status of the order at the Exchange side, either executed successfully, pending, or rejected. |
orderValue | string | Value of the order. |
instrumentName | string | Name of the instrument. |
orderTime | string | Order placement time. |
userId | string | The client code provided to you by SAMCO after opening an account. |
filledQuantity | string | Quantity filled in a specific trade. Can be less than or equal to the total quantity. |
fillPrice | string | Price at which the exchange has filled the order. |
averagePrice | string | Average trading price of the equity. |
unfilledQuantity | string | Quantity which is not filled in a partially filled order. Can be less than or equal to the total quantity. |
exchangeOrderId | string | Unique Order identifier generated from the exchange. |
rejectionReason | string | If the order is rejected, cause of order rejection. |
exchangeConfirmationTime | string | Order confirmation time at the exchange. |
cancelledQuantity | string | Cancelled quantity for partially cancelled orders. |
referenceLimitPrice | string | Limit price reference. |
coverOrderPercentage | string | Percentage of cover order. |
orderRemarks | string | Remarks about the order. |
exchangeOrderNumber | string | Unique Order identifier generated after placing an order. |
symbol | string | Symbol about the stock. |
displayStrikePrice | string | Shows the strike price. |
displayNetQuantity | string | Displays the limit quantity of the order. |
status | string | Status will display Executed/Pending/Rejected. |
exchangeStatus | string | Exchange status will display Executed/Pending/Rejected. |
expiry | string | Shows expiry date of the stock. |
pendingQuantity | string | Pending quantity will show the pending quantity of stock. |
instrument | string | Instrument is about the type of stock. FUT/OPT. |
scripName | string | Name of the scrip. |
totalQuantity | string | Total quantity. |
optionType | string | Option type (PE/CE). |
orderPlacedBy | string | Client code of the user who placed the order. |
lotQuantity | string | Lot quantity represents the number of contracts contained in one derivative security. Applicable for F&O. |
parentOrderId | string | Order ID of the parent order (applicable for only BO/CO orders). |