Skip to content

User Holdings

GET /holding/getHoldings

Get the details of the Stocks which client is holding. Here, you will be able to get the Client holdings which are bought under ‘CNC’ product type and are not sold yet.

Sample Code

bash
curl -X GET 'https://tradeapi.samco.in/holding/getHoldings' \
  -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/holding/getHoldings"))
        .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/holding/getHoldings', {
    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/holding/getHoldings',
  headers=headers)

print(r.json())

Sample Response

json
{
  "serverTime": "12/12/19 16:20:11",
  "msgId": "786cdd94-2fc9-4c38-8f14-672ec64dd032",
  "status": "Success",
  "statusMessage": "Request successful",
  "holdingSummary": {
    "gainingTodayCount": "2",
    "losingTodayCount": "2",
    "totalGainAndLossAmount": "0.00",
    "dayGainAndLossAmount": "-4910.00",
    "portfolioValue": "343.80"
  },
  "holdingDetails": [
    {
      "averagePrice": "1560.15",
      "exchange": "BSE",
      "markToMarketPrice": "-182.70",
      "lastTradedPrice": "1,550.00",
      "previousClose": "1552.55",
      "productCode": "CNC",
      "symbolDescription": "RELIANCE INDUSTRIES LTD.",
      "tradingSymbol": "RELIANCE",
      "totalGainAndLoss": "0.00",
      "calculatedNetQuantity": "18.0",
      "holdingsQuantity": "3",
      "collateralQuantity": "2",
      "holdingsValue": "436.46",
      "isin": "INE917I01010",
      "sellableQuantity": "1",
      "totalMarketToMarketPrice": "0"
    }
  ]
}

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.
holdingSummaryObjectNone.
gainingTodayCountStringCount of scrips which are gaining in value in a trading day.
losingTodayCountStringCount of scrips which are losing in value in a trading day.
totalGainAndLossAmountStringTotal amount of Gain / Loss for all existing positions since their creation.
dayGainAndLossAmountStringAmount of Gain / Loss for all positions on a specific trading day.
portfolioValueStringValue of the portfolio.
holdingDetailsArrayDetails of the user holdings.
averagePriceStringAverage trading price of the equity.
exchangeStringName of the exchange. Valid exchange values (BSE/ NSE). If the user does not provide an exchange name, by default considered as NSE.
markToMarketPriceStringPrice change between previous close price and current price.
lastTradedPriceStringPrice at which last transaction/trade is done.
previousCloseStringPrevious close refers to the prior day's final price of security when the market officially closes for the day.
productCodeStringType of the product, allowable type is CNC.
symbolDescriptionStringScrip Description.
tradingSymbolStringTrading Symbol of the scrip.
totalGainAndLossStringTotal Gain/Loss for all existing positions since their creation.
calculatedNetQuantityStringQuantity left after the day.
holdingsQuantityStringCurrently holding (CNC) quantity.
collateralQuantityStringQuantity of loan against shares offered by SAMCO to their clients for trading in stock and shares.
holdingsValueStringLimit value of the available holdings.
isinStringThe standard ISIN representing stocks uniquely at international level. It is same for every exchange.
sellableQuantityStringQuantity which is open for sale.
totalMarketToMarketPriceStringTotal price change between previous close price and current price.