Skip to content

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

NameTypeRequiredDescription
positionTypestringtruePosition 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

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
positionSummaryobjectnone
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
positionDetails[object]Details of Day/Net positions as queried
averagePricestringAverage trading price of the equity
exchangestringName of the exchange. Valid exchanges 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
tradingSymbolstringSymbol name of the scrip.
calculatedNetQuantitystringQuantity left after the day
averageBuyPricestringAverage price at which the quantities were bought
averageSellPricestringAverage price at which the quantities were sold
boardLotQuantitystringThe standardized number of shares decided by the exchange as a trading unit
boughtPricestringPrice at which quantities were bought during the day
buyQuantitystringTotal quantity brought and added to the position during the day
carryForwardQuantitystringQuantity bought or sold in previous session
carryForwardValuestringNet value of the position in previous session
multiplierstringThe lot size multiplier used to calculate Profit and Loss
netPositionValuestringNet value of the position during the day
netQuantitystringLimit quantity of the position
netValuestringNet value of the bought quantities
positionTypestringType of the position, Ex -Day/Net
positionConversions[string]Different Product types the user can Convert an existing position to
soldValuestringTotal value of sold quantities
transactionTypestringType of the transaction, BUY / SELL
realizedGainAndLossstringThe Profit and Loss returns from a closed position
unrealizedGainAndLossstringThe Profit and Loss returns from an open position
companyNamestringFull name of the trading company
expiryDatestringExpiry date of the scrip
optionTypestringOption Type (PE/CE).