Trade Book
GET /trade/tradeBook
Details of all successfully executed orders placed by the user.
Sample Code
bash
curl -X GET 'https://tradeapi.samco.in/trade/tradeBook' \
-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/trade/tradeBook"))
.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/trade/tradeBook', {
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/trade/tradeBook',
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",
"tradeBookDetails": [
{
"orderNumber": "191206000000079",
"exchange": "BSE",
"tradingSymbol": "RELIANCE",
"symbolDescription": "RELIANCE INDUSTRIES LTD.",
"transactionType": "BUY",
"productCode": "MIS",
"orderType": "L",
"orderPrice": "1560.15",
"quantity": "13",
"disclosedQuantity": "1",
"triggerPrice": "0.00",
"marketProtection": "3",
"orderValidity": "DAY",
"orderStatus": "Complete",
"orderValue": "20281.95",
"instrumentName": "NA",
"orderTime": "06-Dec-2019 13:47:04",
"userId": "DV99999",
"filledQuantity": "13",
"unfilledQuantity": "0",
"exchangeConfirmationTime": "05:06:12",
"coverOrderPercentage": "%",
"exchangeOrderNumber": "1571202357797000054",
"tradeNumber": "195300",
"tradePrice": "1560.15",
"tradeDate": "06DEC2019",
"tradeTime": "02:14:47 PM",
"strikePrice": "800.00",
"optionType": "XX",
"lastTradePrice": "2,077.00",
"expiry": "NA"
}
]
}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. |
tradeBookDetails | [object] | Get list of TradeBookEntries. |
orderNumber | string | Unique Order identifier generated after placing an order. |
exchange | string | Name of the exchange. Valid exchanges values (BSE/ NSE/ NFO/ MCX/ CDS). If the user does not provide an exchange name, by default considered as NSE. For trading with BSE, NFO, CDS, and MCX, 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), MIS (Intraday). |
orderType | string | Type of order 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 | Limit price of a particular order. |
quantity | string | It is the order quantity. |
disclosedQuantity | string | Quantity to disclose to the public in the market. |
triggerPrice | string | The price at which an order should be triggered in case of SL, SL-M. |
marketProtection | string | Percentage of MarketProtection required for ordertype MKT/SL-M to limit loss due to market price changes against the price with which order is placed. Default value is 3%. |
orderValidity | string | Order validity can be DAY / IOC. |
orderStatus | string | Status of the order at Exchange side, either executed successfully or 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 which is filled in a specific trade. Can be less than or equal to the total quantity. |
unfilledQuantity | string | Quantity which is not filled in a partially filled order. Can be less than or equal to the total quantity. |
exchangeConfirmationTime | string | Order confirmation time at exchange. |
coverOrderPercentage | string | Percentage of cover order. |
exchangeOrderNumber | string | Unique Order identifier generated after placing an order. |
tradeNumber | string | Unique trade identifier generated for every trade. |
tradePrice | string | Price of a trade. |
tradeDate | string | Date of a trade. |
tradeTime | string | Time of a trade. |
strikePrice | string | The strike price is the predetermined price at which a put buyer can sell the underlying asset. |
optionType | string | Option Type (PE/CE). |
lastTradePrice | string | Price at which last transaction/trade is done. |
expiry | string | Shows expiry date of a trading symbol. |