Skip to content

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

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.
tradeBookDetails[object]Get list of TradeBookEntries.
orderNumberstringUnique Order identifier generated after placing an order.
exchangestringName 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.
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), MIS (Intraday).
orderTypestringType 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.
orderPricestringLimit price of a particular order.
quantitystringIt is the order quantity.
disclosedQuantitystringQuantity to disclose to the public in the market.
triggerPricestringThe price at which an order should be triggered in case of SL, SL-M.
marketProtectionstringPercentage 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%.
orderValiditystringOrder validity can be DAY / IOC.
orderStatusstringStatus of the order at Exchange side, either executed successfully or 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 which is filled in a specific trade. Can be less than or equal to the total quantity.
unfilledQuantitystringQuantity which is not filled in a partially filled order. Can be less than or equal to the total quantity.
exchangeConfirmationTimestringOrder confirmation time at exchange.
coverOrderPercentagestringPercentage of cover order.
exchangeOrderNumberstringUnique Order identifier generated after placing an order.
tradeNumberstringUnique trade identifier generated for every trade.
tradePricestringPrice of a trade.
tradeDatestringDate of a trade.
tradeTimestringTime of a trade.
strikePricestringThe strike price is the predetermined price at which a put buyer can sell the underlying asset.
optionTypestringOption Type (PE/CE).
lastTradePricestringPrice at which last transaction/trade is done.
expirystringShows expiry date of a trading symbol.