Calculate Capital Gains

post
Calculate Capital Gains

https://api.sandbox.co.in/calculators/income-tax/securities/capital-gains
Calculate Capital gains using Security Transactions.
Request
Response
Request
Headers
Authorization
required
string
JWT Authorization token
x-api-key
required
string
Public key required to authorize API access
x-api-version
optional
string
Response
200: OK
{
"code": 200,
"transaction_id": "8225c376-58b2-49e4-a079-c521b97d8864",
"timestamp": 1620724192345,
"data": {
"trade_wise": {
"equity": [
[
"symbol",
"isin",
"buy_date",
"buy_average",
"quantity",
"sell_date",
"sell_average",
"fmv",
"charges",
"coa",
"holding_period",
"gross_profit",
"net_profit"
],
[
"5PAISA",
"INE618L01018",
"2018-07-11T03:05:00",
186.4,
2.0,
"2019-04-11T08:05:00",
235.1,
0.0,
0.0,
186.4,
"Short Term",
97.4,
97.4
]
],
"mutual_fund": [
[
"symbol",
"isin",
"asset_class",
"buy_date",
"buy_average",
"quantity",
"sell_date",
"sell_average",
"fmv",
"charges",
"coa",
"holding_period",
"gross_profit",
"net_profit"
],
[
"Axis Liquid Fund - Direct Plan",
"INF846K01CX4",
"Debt",
"2018-05-29T03:05:00",
1948.9817,
0.513,
"2019-08-13T03:08:00",
2127.2655,
0.0,
19.4596,
1948.9817,
"Short Term",
91.3233,
71.8637
]
]
},
"matrix": [
[
0,
0,
0,
0,
0,
0,
null
],
[
97,
null,
0,
0,
null,
null,
97
],
[
0,
0,
null,
0,
null,
null,
0
],
[
72,
0,
0,
null,
null,
null,
72
],
[
0,
0,
0,
0,
null,
0,
0
],
[
0,
0,
0,
0,
null,
0,
0
],
[
0,
0,
0,
0,
0,
null,
0
],
[
null,
0,
0,
0,
0,
0,
null
],
[
null,
0,
0,
0,
0,
0,
null
]
]
}
}
500: Internal Server Error
{
"code": 500,
"transaction_id": "8225c376-58b2-49e4-a079-c521b97d8864",
"timestamp": 1620724192345,
"message": "Failed to calculate capital gain"
}

BODY Raw

{
"equity": [
[
"symbol",
"isin",
"buy_date",
"buy_average",
"quantity",
"sell_date",
"sell_average",
"fmv",
"charges"
],
[
"5PAISA",
"INE618L01018",
"2018-07-11T03:05:00",
186.4,
2.0,
"2019-04-11T08:05:00",
235.1,
0.0,
0.0
]
],
"mutual_fund":[
[
"symbol",
"isin",
"asset_class",
"buy_date",
"buy_average",
"quantity",
"sell_date",
"sell_average",
"fmv",
"charges"
],
[
"Axis Liquid Fund - Direct Plan",
"INF846K01CX4",
"Debt",
"2018-05-29T03:05:00",
1948.9817,
0.513,
"2019-08-13T03:08:00",
2127.2655,
0.0,
91.4596
]
]
}

Example Request

cURL
Java
Node.js
Python
cURL
curl --location --request POST 'https://api.sandbox.co.in/calculators/income-tax/securities/capital-gains' \
--header 'Authorization: eyJhbGciOiJIUzUxMiJ9.eyJhdWQiOiJBUEkiLCJyZWZyZXNoX3Rva2VuIjoiZXlKaGJHY2lPaUpJVXpVeE1pSjkuZXlKaGRXUWlPaUpCVUVraUxDSnpkV0lpT2lKclpYbGZiR2wyWlY5QlpHVXFLaW9xS2lvcUtpb3FLaW9xS2lvcUtpb3FLaW9xS2lvcUtsVjRjeUlzSW1Gd2FWOXJaWGtpT2lKclpYbGZiR2wyWlY5QlpHVXFLaW9xS2lvcUtpb3FLaW9xS2lvcUtpb3FLaW9xS2lvcUtsVjRjeUlzSW1semN5STZJbUZ3YVM1eGRXbGphMjh1WTI5dElpd2laWGh3SWpveE5Ua3dPVFk1TmpBd0xDSnBiblJsYm5RaU9pSlNSVVpTUlZOSVgxUlBTMFZPSWl3aWFXRjBJam94TlRVNU16UTNNakF3ZlEueHNmYkhQTERFRlRvTy1OUWdaUUpLM25OUjFxdlhvWmhaOHRqS3gzSExydjZiVkJaMHpJZEZ5ai1MUTg1YnJZS0xXQnFnZHlzZ1NDSXlDUXNtV2VOYkEiLCJzdWIiOiJqb2huQGRvZS5jb20iLCJhcGlfa2V5Ijoia2V5X2xpdmVfQWRlKioqKioqKioqKioqKioqKioqKioqKioqKipVeHMiLCJpc3MiOiJhcGkucXVpY2tvLmNvbSIsImV4cCI6MTU5MTA1NjAwMCwiaW50ZW50IjoiQUNDRVNTX1RPS0VOIiwiaWF0IjoxNTkwOTY5NjAwfQ.nH23CR5RHGQ0U19I_vq3vyJ_85A1a2iEMQij5QHgJQdDuS9x7FmTidsr1CQabSFF5ujE40SFxHv1gJM20TauUw' \
--header 'x-api-key: key_live_Ade**************************Uxs' \
--header 'x-api-version: 3.4' \
--header 'Content-Type: application/json' \
--data-raw '{
"equity": [
[
"symbol",
"isin",
"buy_date",
"buy_average",
"quantity",
"sell_date",
"sell_average",
"fmv",
"charges"
],
[
"5PAISA",
"INE618L01018",
"2018-07-11T03:05:00",
186.4,
2.0,
"2019-04-11T08:05:00",
235.1,
0.0,
0.0
]
],
"mutual_fund":[
[
"symbol",
"isin",
"asset_class",
"buy_date",
"buy_average",
"quantity",
"sell_date",
"sell_average",
"fmv",
"charges"
],
[
"Axis Liquid Fund - Direct Plan",
"INF846K01CX4",
"Debt",
"2018-05-29T03:05:00",
1948.9817,
0.513,
"2019-08-13T03:08:00",
2127.2655,
0.0,
91.4596
]
]
}'
Java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"equity\": [\r\n [\r\n \"symbol\",\r\n \"isin\",\r\n \"buy_date\",\r\n \"buy_average\",\r\n \"quantity\", \r\n \"sell_date\",\r\n \"sell_average\", \r\n \"fmv\",\r\n \"charges\"\r\n ],\r\n [\r\n \"5PAISA\",\r\n \"INE618L01018\",\r\n \"2018-07-11T03:05:00\",\r\n 186.4,\r\n 2.0, \r\n \"2019-04-11T08:05:00\",\r\n 235.1, \r\n 0.0,\r\n 0.0 \r\n ]\r\n ],\r\n \"mutual_fund\":[\r\n [\r\n \"symbol\",\r\n \"isin\",\r\n \"asset_class\",\r\n \"buy_date\",\r\n \"buy_average\",\r\n \"quantity\", \r\n \"sell_date\",\r\n \"sell_average\", \r\n \"fmv\", \r\n \"charges\"\r\n\r\n ],\r\n [\r\n \"Axis Liquid Fund - Direct Plan\",\r\n \"INF846K01CX4\", \r\n \"Debt\",\r\n \"2018-05-29T03:05:00\",\r\n 1948.9817,\r\n 0.513, \r\n \"2019-08-13T03:08:00\",\r\n 2127.2655, \r\n 0.0,\r\n 91.4596 \r\n ]\r\n ]\r\n}");
Request request = new Request.Builder()
.url("https://api.sandbox.co.in/calculators/income-tax/securities/capital-gains")
.method("POST", body)
.addHeader("Authorization", "eyJhbGciOiJIUzUxMiJ9.eyJhdWQiOiJBUEkiLCJyZWZyZXNoX3Rva2VuIjoiZXlKaGJHY2lPaUpJVXpVeE1pSjkuZXlKaGRXUWlPaUpCVUVraUxDSnpkV0lpT2lKclpYbGZiR2wyWlY5QlpHVXFLaW9xS2lvcUtpb3FLaW9xS2lvcUtpb3FLaW9xS2lvcUtsVjRjeUlzSW1Gd2FWOXJaWGtpT2lKclpYbGZiR2wyWlY5QlpHVXFLaW9xS2lvcUtpb3FLaW9xS2lvcUtpb3FLaW9xS2lvcUtsVjRjeUlzSW1semN5STZJbUZ3YVM1eGRXbGphMjh1WTI5dElpd2laWGh3SWpveE5Ua3dPVFk1TmpBd0xDSnBiblJsYm5RaU9pSlNSVVpTUlZOSVgxUlBTMFZPSWl3aWFXRjBJam94TlRVNU16UTNNakF3ZlEueHNmYkhQTERFRlRvTy1OUWdaUUpLM25OUjFxdlhvWmhaOHRqS3gzSExydjZiVkJaMHpJZEZ5ai1MUTg1YnJZS0xXQnFnZHlzZ1NDSXlDUXNtV2VOYkEiLCJzdWIiOiJqb2huQGRvZS5jb20iLCJhcGlfa2V5Ijoia2V5X2xpdmVfQWRlKioqKioqKioqKioqKioqKioqKioqKioqKipVeHMiLCJpc3MiOiJhcGkucXVpY2tvLmNvbSIsImV4cCI6MTU5MTA1NjAwMCwiaW50ZW50IjoiQUNDRVNTX1RPS0VOIiwiaWF0IjoxNTkwOTY5NjAwfQ.nH23CR5RHGQ0U19I_vq3vyJ_85A1a2iEMQij5QHgJQdDuS9x7FmTidsr1CQabSFF5ujE40SFxHv1gJM20TauUw")
.addHeader("x-api-key", "key_live_Ade**************************Uxs")
.addHeader("x-api-version", "3.4")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Node.js
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.sandbox.co.in/calculators/income-tax/securities/capital-gains',
'headers': {
'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJhdWQiOiJBUEkiLCJyZWZyZXNoX3Rva2VuIjoiZXlKaGJHY2lPaUpJVXpVeE1pSjkuZXlKaGRXUWlPaUpCVUVraUxDSnpkV0lpT2lKclpYbGZiR2wyWlY5QlpHVXFLaW9xS2lvcUtpb3FLaW9xS2lvcUtpb3FLaW9xS2lvcUtsVjRjeUlzSW1Gd2FWOXJaWGtpT2lKclpYbGZiR2wyWlY5QlpHVXFLaW9xS2lvcUtpb3FLaW9xS2lvcUtpb3FLaW9xS2lvcUtsVjRjeUlzSW1semN5STZJbUZ3YVM1eGRXbGphMjh1WTI5dElpd2laWGh3SWpveE5Ua3dPVFk1TmpBd0xDSnBiblJsYm5RaU9pSlNSVVpTUlZOSVgxUlBTMFZPSWl3aWFXRjBJam94TlRVNU16UTNNakF3ZlEueHNmYkhQTERFRlRvTy1OUWdaUUpLM25OUjFxdlhvWmhaOHRqS3gzSExydjZiVkJaMHpJZEZ5ai1MUTg1YnJZS0xXQnFnZHlzZ1NDSXlDUXNtV2VOYkEiLCJzdWIiOiJqb2huQGRvZS5jb20iLCJhcGlfa2V5Ijoia2V5X2xpdmVfQWRlKioqKioqKioqKioqKioqKioqKioqKioqKipVeHMiLCJpc3MiOiJhcGkucXVpY2tvLmNvbSIsImV4cCI6MTU5MTA1NjAwMCwiaW50ZW50IjoiQUNDRVNTX1RPS0VOIiwiaWF0IjoxNTkwOTY5NjAwfQ.nH23CR5RHGQ0U19I_vq3vyJ_85A1a2iEMQij5QHgJQdDuS9x7FmTidsr1CQabSFF5ujE40SFxHv1gJM20TauUw',
'x-api-key': 'key_live_Ade**************************Uxs',
'x-api-version': '3.4',
'Content-Type': 'application/json'
},
body: JSON.stringify({"equity":[["symbol","isin","buy_date","buy_average","quantity","sell_date","sell_average","fmv","charges"],["5PAISA","INE618L01018","2018-07-11T03:05:00",186.4,2,"2019-04-11T08:05:00",235.1,0,0]],"mutual_fund":[["symbol","isin","asset_class","buy_date","buy_average","quantity","sell_date","sell_average","fmv","charges"],["Axis Liquid Fund - Direct Plan","INF846K01CX4","Debt","2018-05-29T03:05:00",1948.9817,0.513,"2019-08-13T03:08:00",2127.2655,0,91.4596]]})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Python
import requests
url = "https://api.sandbox.co.in/calculators/income-tax/securities/capital-gains"
payload="{\r\n \"equity\": [\r\n [\r\n \"symbol\",\r\n \"isin\",\r\n \"buy_date\",\r\n \"buy_average\",\r\n \"quantity\", \r\n \"sell_date\",\r\n \"sell_average\", \r\n \"fmv\",\r\n \"charges\"\r\n ],\r\n [\r\n \"5PAISA\",\r\n \"INE618L01018\",\r\n \"2018-07-11T03:05:00\",\r\n 186.4,\r\n 2.0, \r\n \"2019-04-11T08:05:00\",\r\n 235.1, \r\n 0.0,\r\n 0.0 \r\n ]\r\n ],\r\n \"mutual_fund\":[\r\n [\r\n \"symbol\",\r\n \"isin\",\r\n \"asset_class\",\r\n \"buy_date\",\r\n \"buy_average\",\r\n \"quantity\", \r\n \"sell_date\",\r\n \"sell_average\", \r\n \"fmv\", \r\n \"charges\"\r\n\r\n ],\r\n [\r\n \"Axis Liquid Fund - Direct Plan\",\r\n \"INF846K01CX4\", \r\n \"Debt\",\r\n \"2018-05-29T03:05:00\",\r\n 1948.9817,\r\n 0.513, \r\n \"2019-08-13T03:08:00\",\r\n 2127.2655, \r\n 0.0,\r\n 91.4596 \r\n ]\r\n ]\r\n}"
headers = {
'Authorization': 'eyJhbGciOiJIUzUxMiJ9.eyJhdWQiOiJBUEkiLCJyZWZyZXNoX3Rva2VuIjoiZXlKaGJHY2lPaUpJVXpVeE1pSjkuZXlKaGRXUWlPaUpCVUVraUxDSnpkV0lpT2lKclpYbGZiR2wyWlY5QlpHVXFLaW9xS2lvcUtpb3FLaW9xS2lvcUtpb3FLaW9xS2lvcUtsVjRjeUlzSW1Gd2FWOXJaWGtpT2lKclpYbGZiR2wyWlY5QlpHVXFLaW9xS2lvcUtpb3FLaW9xS2lvcUtpb3FLaW9xS2lvcUtsVjRjeUlzSW1semN5STZJbUZ3YVM1eGRXbGphMjh1WTI5dElpd2laWGh3SWpveE5Ua3dPVFk1TmpBd0xDSnBiblJsYm5RaU9pSlNSVVpTUlZOSVgxUlBTMFZPSWl3aWFXRjBJam94TlRVNU16UTNNakF3ZlEueHNmYkhQTERFRlRvTy1OUWdaUUpLM25OUjFxdlhvWmhaOHRqS3gzSExydjZiVkJaMHpJZEZ5ai1MUTg1YnJZS0xXQnFnZHlzZ1NDSXlDUXNtV2VOYkEiLCJzdWIiOiJqb2huQGRvZS5jb20iLCJhcGlfa2V5Ijoia2V5X2xpdmVfQWRlKioqKioqKioqKioqKioqKioqKioqKioqKipVeHMiLCJpc3MiOiJhcGkucXVpY2tvLmNvbSIsImV4cCI6MTU5MTA1NjAwMCwiaW50ZW50IjoiQUNDRVNTX1RPS0VOIiwiaWF0IjoxNTkwOTY5NjAwfQ.nH23CR5RHGQ0U19I_vq3vyJ_85A1a2iEMQij5QHgJQdDuS9x7FmTidsr1CQabSFF5ujE40SFxHv1gJM20TauUw',
'x-api-key': 'key_live_Ade**************************Uxs',
'x-api-version': '3.4',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)