User Positions
GET /position/getPositions
Get position details of the user (The details of equity, derivative, commodity, currency borrowed or owned by the user).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
positionType | string | true | Position type can be DAY/NET. If Position type is “DAY”, fetch current day position details. If Position Type is “NET”, fetch carry forward position details. |
Sample Code
bash
curl -X GET 'https://tradeapi.samco.in/position/getPositions?positionType=DAY' \
-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/position/getPositions?positionType=DAY"))
.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/position/getPositions?positionType=DAY', {
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/position/getPositions?positionType=DAY',
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",
"positionSummary": {
"gainingTodayCount": "2",
"losingTodayCount": "2",
"totalGainAndLossAmount": "0.00",
"dayGainAndLossAmount": "-4910.00"
},
"positionDetails": [
{
"averagePrice": "1560.15",
"exchange": "BSE",
"markToMarketPrice": "-182.70",
"lastTradedPrice": "1,550.00",
"previousClose": "1552.55",
"productCode": "CNC",
"symbolDescription": "RELIANCE INDUSTRIES LTD.",
"tradingSymbol": "RELIANCE",
"calculatedNetQuantity": "18.0",
"averageBuyPrice": "1560.15",
"averageSellPrice": "0.00",
"boardLotQuantity": "1",
"boughtPrice": "28082.70",
"buyQuantity": "18",
"carryForwardQuantity": "0",
"carryForwardValue": "0.00",
"multiplier": "1",
"netPositionValue": "-182.70",
"netQuantity": "18",
"netValue": "-182.70",
"positionType": "DAY",
"positionConversions": "CNC, NRML",
"soldValue": "0.00",
"transactionType": "BUY",
"realizedGainAndLoss": "0.00",
"unrealizedGainAndLoss": "-182.70",
"companyName": "RELIANCE INDUSTRIES LTD.",
"expiryDate": "--",
"optionType": "--"
}
]
}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 |
positionSummary | 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 |
positionDetails | [object] | Details of Day/Net positions as queried |
averagePrice | string | Average trading price of the equity |
exchange | string | Name of the exchange. Valid exchanges 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 | Symbol name of the scrip. |
calculatedNetQuantity | string | Quantity left after the day |
averageBuyPrice | string | Average price at which the quantities were bought |
averageSellPrice | string | Average price at which the quantities were sold |
boardLotQuantity | string | The standardized number of shares decided by the exchange as a trading unit |
boughtPrice | string | Price at which quantities were bought during the day |
buyQuantity | string | Total quantity brought and added to the position during the day |
carryForwardQuantity | string | Quantity bought or sold in previous session |
carryForwardValue | string | Net value of the position in previous session |
multiplier | string | The lot size multiplier used to calculate Profit and Loss |
netPositionValue | string | Net value of the position during the day |
netQuantity | string | Limit quantity of the position |
netValue | string | Net value of the bought quantities |
positionType | string | Type of the position, Ex -Day/Net |
positionConversions | [string] | Different Product types the user can Convert an existing position to |
soldValue | string | Total value of sold quantities |
transactionType | string | Type of the transaction, BUY / SELL |
realizedGainAndLoss | string | The Profit and Loss returns from a closed position |
unrealizedGainAndLoss | string | The Profit and Loss returns from an open position |
companyName | string | Full name of the trading company |
expiryDate | string | Expiry date of the scrip |
optionType | string | Option Type (PE/CE). |