Skip to content

Personal Index

GET /indexData

The Personal Index API provides detailed insights into a user's trading performance by aggregating the overall profit and loss of all executed trades. This API delivers comprehensive data on an individual's personal index, allowing users to monitor and analyze their trading activities efficiently. It is an essential tool for evaluating performance metrics and managing investment strategies based on historical trade outcomes.

Sample Code

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

print(r.json())

Sample Response

json
{
  "serverTime": "04/04/24 11:22:12",
  "msgId": "2164268d-d38b-490e-bbb2-d3cedda3a907",
  "status": "Success",
  "statusMessage": "Index Data retrieved successfully",
  "indexData": {
    "indexName": "MXXXXXXD IXXXx",
    "networth": "209.52",
    "indexData": {
      "index": "4.04",
      "indexChange": "0.04",
      "indexChangePercentage": "1.04",
      "latestTime": "2024-04-04 11:21:00",
      "networthChange": "2.15",
      "networthChangePercentage": "1.04",
      "fundReceipt": "0.00"
    }
  }
}

Response Schema

Status Code 200

NameTypeDescription
serverTimestringThe date and time when the server generated the response.
msgIdstringA unique identifier for the API response message. Useful for tracking or debugging.
statusstringThe status of the API response. Possible values: 'Success', 'Error', or 'Failure'.
statusMessagestringA message describing the result of the API call.
indexDataDetailsObjectDetailed information about the user's personal index.
indexNamestringThe name of the personal index.
networthstringThe current net worth associated with the personal index.
indexDataObjectSpecific details about the index's performance.
IndexstringThe current value of the index.
IndexChangestringThe absolute change in the index value compared to the previous update.
IndexChangePercentagestringThe percentage change in the index value compared to the previous update.
latestTimestringThe timestamp indicating the most recent update to the index data.
networthChangestringThe variance between yesterday's and today's net worth values.
networthChangePercentagestringThe percentage change in net worth value from yesterday to today.
fundReceiptstringToday's payment amount: the sum received or transferred to fund.