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
| 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. |
holdingSummary | Object | None. |
gainingTodayCount | String | Count of scrips which are gaining in value in a trading day. |
losingTodayCount | String | Count of scrips which are losing in value in a trading day. |
totalGainAndLossAmount | String | Total amount of Gain / Loss for all existing positions since their creation. |
dayGainAndLossAmount | String | Amount of Gain / Loss for all positions on a specific trading day. |
portfolioValue | String | Value of the portfolio. |
holdingDetails | Array | Details of the user holdings. |
averagePrice | String | Average trading price of the equity. |
exchange | String | Name of the exchange. Valid exchange values (BSE/ NSE). If the user does not provide an exchange name, by default considered as NSE. |
markToMarketPrice | String | Price change between previous close price and current price. |
lastTradedPrice | String | Price at which last transaction/trade is done. |
previousClose | String | Previous close refers to the prior day's final price of security when the market officially closes for the day. |
productCode | String | Type of the product, allowable type is CNC. |
symbolDescription | String | Scrip Description. |
tradingSymbol | String | Trading Symbol of the scrip. |
totalGainAndLoss | String | Total Gain/Loss for all existing positions since their creation. |
calculatedNetQuantity | String | Quantity left after the day. |
holdingsQuantity | String | Currently holding (CNC) quantity. |
collateralQuantity | String | Quantity of loan against shares offered by SAMCO to their clients for trading in stock and shares. |
holdingsValue | String | Limit value of the available holdings. |
isin | String | The standard ISIN representing stocks uniquely at international level. It is same for every exchange. |
sellableQuantity | String | Quantity which is open for sale. |
totalMarketToMarketPrice | String | Total price change between previous close price and current price. |