Tradebook P&L
Tradebook provides you with all the trades that have been executed by an investor or trader. Brokers can use Tradebook to calculate Tax P&L using APIs.
Overview
This API calculates Tax P&L by taking in the tradebook data.
Problem
- Brokers have to provide accurate Realized & Unrealized P&L.
- Brokers must apply tax rules to accurately calculate Pre-Tax & Post-Tax returns on investments.
- The tax landscape is ever-changing with announcements from regulators, tax departments & finance ministry.
- Investors & Traders have to furnish accurate P&L, Holdings, and Turnover in their tax returns as per the tax law.
- Brokers are unable to provide accurate tax computations.
Solution
- API to calculate Tax P&L in real-time.
- API covers tax calculation for corporate actions such as dividends, buybacks, etc.
- Allows Brokers to visualize Tax P&L for their users.
- Tax P&L report can be generated using tradewise or scripwise method.
Endpoint
HTTP Method | Endpoint |
---|---|
POST | /calculators/income-tax/securities/tax-pnl/tradebook |
Request
Follow the below guidelines to calculate Tradebook Tax P&L
Query Parameters
Param | Type | Description | Example |
---|---|---|---|
report | string | Possible values: Tradewise, Scripwise | tradewise |
from | number | From Date in Epoch milliseconds | 1667241000000 |
to | number | To Date, in Epoch milliseconds | 1669746600000 |
Body
Foreign Equity Trade
The headers are explained below:
Param | Type | Required | Description |
---|---|---|---|
isin | string | No | ISIN is the international security identification number |
symbol | string | Yes | Symbol or description of equity share |
quantity | number | Yes | Trading quantity |
date | number | Yes | Transaction epoch timestamp |
price | number | Yes | Transaction price |
transaction_type | string | Yes | Transaction type from possible values of 'BUY' or 'SELL' |
transfer_expenses | number | Yes | Transfer expense |
corporate_action | string | No | Refer to Corporate Action for possible values |
ADR
The headers are explained below:
Param | Type | Required | Description |
---|---|---|---|
isin | string | No | ISIN is the international security identification number |
symbol | string | Yes | Symbol or description of equity share |
quantity | number | Yes | Trading quantity |
date | number | Yes | Transaction epoch timestamp |
price | number | Yes | Transaction price |
transaction_type | string | Yes | Transaction type from possible values of 'BUY' or 'SELL' |
transfer_expenses | number | Yes | Transfer expense |
corporate_action | string | No | Refer to Corporate Action for possible values |
Foreign Mutual Fund Trade
The headers are explained below:
Param | Type | Required | Description |
---|---|---|---|
isin | string | No | ISIN is the international security identification number |
type | string | Yes | Scheme type, possible valuesEquity , Debt , Other |
symbol | string | Yes | Symbol or description of equity share |
quantity | number | Yes | Trading quantity |
date | number | Yes | Transaction epoch timestamp |
price | number | Yes | Transaction price |
transaction_type | string | Yes | Transaction type from possible values of 'BUY' or 'SELL' |
transfer_expenses | number | Yes | Transfer expense |
Foreign Futures and Options Trade
The headers are explained below:
Param | Type | Required | Description |
---|---|---|---|
symbol | string | Yes | Symbol or description of equity share |
type | string | Yes | Type, possible valuesFutures , Options |
quantity | number | Yes | Trading quantity |
date | number | Yes | Transaction epoch timestamp |
price | number | Yes | Transaction price |
transaction_type | string | Yes | Transaction type possible values 'BUY' 'SELL' |
transfer_expenses | number | Yes | Transfer expenses |
Equity Trade
The headers are explained below:
Param | Type | Required | Description |
---|---|---|---|
isin | string | No | ISIN is the international security identification number |
symbol | string | Yes | Symbol or description of equity share |
quantity | number | Yes | Trading quantity |
date | number | Yes | Transaction epoch timestamp |
price | number | Yes | Transaction price |
transaction_type | string | Yes | Transaction type from possible values of 'BUY' or 'SELL' |
fmv | number | No | High stock price on 31/01/2018 |
brokerage | number | No | Brokerage expense |
clearing_charges | number | No | Charges charged by clearing house |
exchange_transaction_charges | number | No | Transaction charges by exchange |
sebi_turnover_fees | number | No | Turnover fees by SEBI |
stt | number | No | Security Transaction Tax |
stamp_duty | number | No | Stamp duty paid on transfer of shares |
sgst | number | No | State GST |
cgst | number | No | Central GST |
igst | number | No | Integrated GST |
other_transfer_expenses | number | No | Any other expense relating to the transfer of shares |
corporate_action | string | No | Refer to Corporate Action for possible values |
Mutual Fund Trade
The headers are explained below:
Param | Type | Required | Description |
---|---|---|---|
isin | string | No | ISIN is the international security identification number |
type | string | Yes | Scheme type, possible valuesEquity , Debt , Other |
symbol | string | Yes | Symbol or description of equity share |
quantity | number | Yes | Trading quantity |
date | number | Yes | Transaction epoch timestamp |
price | number | Yes | Transaction price |
transaction_type | string | Yes | Transaction type possible value 'BUY' 'SELL' |
fmv | number | No | High stock price on 31/01/2018 |
brokerage | number | No | Brokerage expense |
clearing_charges | number | No | Charges charged by clearing house |
exchange_transaction_charges | number | No | Transaction charges by exchange |
sebi_turnover_fees | number | No | Turnover fees by SEBI |
stt | number | No | Security Transaction Tax |
stamp_duty | number | No | Stamp duty paid on transfer of shares |
sgst | number | No | State GST |
cgst | number | No | Central GST |
igst | number | No | Integrated GST |
other_transfer_expenses | number | No | Any other expense relating to the transfer of shares |
Futures and Options Trade
The headers are explained below:
Param | Type | Required | Description |
---|---|---|---|
symbol | string | Yes | Symbol or description of equity share |
type | string | Yes | Type, possible valuesFutures , Options |
quantity | number | Yes | Trading quantity |
date | number | Yes | Transaction epoch timestamp |
price | number | Yes | Transaction price |
transaction_type | string | Yes | Transaction type possible values 'BUY' 'SELL' |
brokerage | number | No | Brokerage expense |
clearing_charges | number | No | Charges charged by clearing house |
exchange_transaction_charges | number | No | Transaction charges by exchange |
sebi_turnover_fees | number | No | Turnover fees by SEBI |
stt | number | No | Security Transaction Tax |
stamp_duty | number | No | Stamp duty paid on transfer of shares |
sgst | number | No | State GST |
cgst | number | No | Central GST |
igst | number | No | Integrated GST |
other_transfer_expenses | number | No | Any other expense relating to the transfer of shares |
Corporate Actions
The enumeration is explained below:
Corporate Action | ENUM |
---|---|
Amalgamation | AMALGAMATION |
Bonus Issue | BONUS_ISSUE |
Buy Back of Shares | BUY_BACK |
Consolidation of Shares | CONSOLIDATION |
Dividend | DIVIDEND |
Dividend on Preference Shares | DIVIDEND |
Income Distribution (InvIT) | INCOME_DISTRIBUTION_INVIT |
Income Distribution RITES | RITES |
InvIT - Return of Capital | RETURN_OF_CAPITAL_INVIT |
Preferential Issue of shares | PREFERENTIAL_ISSUE |
Reduction of Capital | REDUCTION_OF_CAPITAL |
Right Issue of Equity Shares | RIGHT_ISSUE |
Scheme of Arrangement | SCHEME_OF_ARRANGEMENT |
Spin Off | SPIN_OFF |
Stock Split | STOCK_SPLIT |
Voluntary Delisting of Shares | DELISTING |
Sample CURL Request
curl --request POST \
--url 'https://api.sandbox.co.in/calculators/income-tax/securities/tax-pnl/tradebook?report=Tradewise&from=1667241000000&to=1669746600000' \
--header 'Authorization: xxxxxxxxxxxxxx' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-api-key: xxxxxxxxxxxxxx' \
--header 'x-api-version: 1.0' \
--data '
{
"sheets": [
{
"name": "Foreign Equity",
"metadata": {
"currency": "USD"
},
"blocks": [
{
"name": "Tradebook",
"@entity": "table",
"header": [
"isin",
"symbol",
"quantity",
"date",
"price",
"transaction_type",
"transfer_expenses",
"corporate_action"
],
"rows": [
[
null,
"BHG",
1,
1643380439478,
2.59,
"SELL",
1,
null
],
[
null,
"AAPL",
0.7644,
1643380387229,
164.29,
"SELL",
1,
null
],
[
null,
"AAPL",
0.1,
1634751623480,
148.5,
"BUY",
0.99,
null
],
[
null,
"AAPL",
0.6644,
1634147917942,
143.29,
"BUY",
0,
null
],
[
null,
"BHG",
1,
1630598986512,
9.63,
"BUY",
0.05,
null
],
[
null,
"STXS",
0.4347826,
1628536115398,
9.2,
"SELL",
3,
null
],
[
null,
"AMZN",
0.00149749,
1628536054329,
3338.92,
"BUY",
2.99,
null
],
[
null,
"BTBT",
2.55754475,
1628189423570,
15.77,
"SELL",
3,
null
],
[
null,
"BTBT",
2.55754475,
1628189293460,
15.64,
"BUY",
2.99,
null
],
[
null,
"STXS",
1.10987791,
1628017687633,
9.01,
"BUY",
2.99,
null
],
[
null,
"COOL",
0.2,
1626457655107,
9.75,
"BUY",
2.99,
null
]
]
},
{
"name": "Metadata",
"@entity": "table",
"header": [
"isin",
"symbol",
"address",
"country",
"zip_code",
"52_week_high",
"closing_value"
],
"rows": [
[
null,
"AAPL",
"ONE APPLE PARK WAY, CUPERTINO, CA 95014",
"United States of America",
"95014",
52,
177.57000732421875
],
[
null,
"AMZN",
"410 TERRY AVENUE NORTH, SEATTLE, WA 98109",
"United States of America",
"98109",
52,
3334.340087890625
],
[
null,
"BHG",
"8000 NORMAN CENTER DRIVE, SUITE 1200, MINNEAPOLIS, MN 55437",
"United States of America",
"55437",
52,
3.440000057220459
],
[
null,
"BTBT",
"136-20 38th Avenue Suite 9A-2 Flushing New York, NY 11354",
"China",
"11354",
52,
6.079999923706055
],
[
null,
"COOL",
"251 LYTTON AVENUE, SUITE 200, PALO ALTO, CA 94301",
"United States of America",
"94301",
52,
9.800000190734863
],
[
null,
"STXS",
"4320 FOREST PARK AVENUE, SUITE 100, ST.LOUIS, MO 63108",
"United States of America",
"63108",
52,
6.199999809265137
],
[
null,
"AAPL",
"ONE APPLE PARK WAY, CUPERTINO, CA 95014",
"United States of America",
"95014",
52,
174.61
],
[
null,
"AMZN",
"410 TERRY AVENUE NORTH, SEATTLE, WA 98109",
"United States of America",
"98109",
52,
3259.95
],
[
null,
"BHG",
"8000 NORMAN CENTER DRIVE, SUITE 1200, MINNEAPOLIS, MN 55437",
"United States of America",
"55437",
52,
1.93
],
[
null,
"BTBT",
"136-20 38th Avenue Suite 9A-2 Flushing New York, NY 11354",
"China",
"11354",
52,
3.6
],
[
null,
"COOL",
"251 LYTTON AVENUE, SUITE 200, PALO ALTO, CA 94301",
"United States of America",
"94301",
52,
9.82
],
[
null,
"STXS",
"4320 FOREST PARK AVENUE, SUITE 100, ST.LOUIS, MO 63108",
"United States of America",
"63108",
52,
3.73
],
[
null,
"AAPL",
"ONE APPLE PARK WAY, CUPERTINO, CA 95014",
"United States of America",
"95014",
52,
174.61
],
[
null,
"AMZN",
"410 TERRY AVENUE NORTH, SEATTLE, WA 98109",
"United States of America",
"98109",
52,
3259.95
],
[
null,
"BHG",
"8000 NORMAN CENTER DRIVE, SUITE 1200, MINNEAPOLIS, MN 55437",
"United States of America",
"55437",
52,
1.93
],
[
null,
"BTBT",
"136-20 38th Avenue Suite 9A-2 Flushing New York, NY 11354",
"China",
"11354",
52,
3.6
],
[
null,
"COOL",
"251 LYTTON AVENUE, SUITE 200, PALO ALTO, CA 94301",
"United States of America",
"94301",
52,
9.82
],
[
null,
"STXS",
"4320 FOREST PARK AVENUE, SUITE 100, ST.LOUIS, MO 63108",
"United States of America",
"63108",
52,
3.73
]
]
}
]
},
{
"name": "Foreign Mutual Funds",
"metadata": {
"currency": "USD"
},
"blocks": [
{
"name": "Tradebook",
"@entity": "table",
"header": [
"isin",
"type",
"symbol",
"quantity",
"date",
"price",
"transaction_type",
"transfer_expenses",
"corporate_action"
],
"rows": [
[
null,
"Equity",
"Vanguard S&P 500 ETF",
50,
1599589800001,
6,
"BUY",
2.99,
null
],
[
null,
"Equity",
"Vanguard S&P 500 ETF",
35,
1643804395000,
8.5,
"SELL",
2.99,
null
],
[
null,
"Debt",
"Vanguard Short-Term Bond ETF",
35,
1599589800001,
6,
"BUY",
2.99,
null
]
]
},
{
"name": "Metadata",
"@entity": "table",
"header": [
"isin",
"symbol",
"address",
"country",
"zip_code",
"52_week_high",
"closing_value"
],
"rows": [
[
null,
"Vanguard Short-Term Bond ETF",
"ONE APPLE PARK WAY, CUPERTINO, CA 95014",
"United States of America",
"95014",
52,
177.57000732421875
],
[
null,
"Vanguard S&P 500 ETF",
"ONE APPLE PARK WAY, CUPERTINO, CA 95014",
"United States of America",
"95014",
52,
177.57000732421875
]
]
}
]
},
{
"name": "ADR",
"metadata": {
"currency": "USD"
},
"blocks": [
{
"name": "Tradebook",
"@entity": "table",
"header": [
"isin",
"symbol",
"quantity",
"date",
"price",
"transaction_type",
"transfer_expenses",
"corporate_action"
],
"rows": [
[
null,
"Infosys Ltd ADR",
50,
1599589800001,
6,
"BUY",
2.99,
null
],
[
null,
"Infosys Ltd ADR",
15,
1599589800001,
7.9,
"SELL",
2.99,
null
]
]
},
{
"name": "Metadata",
"@entity": "table",
"header": [
"isin",
"symbol",
"address",
"country",
"zip_code",
"52_week_high",
"closing_value"
],
"rows": [
[
null,
"Infosys Ltd ADR",
"ONE APPLE PARK WAY, CUPERTINO, CA 95014",
"United States of America",
"95014",
52,
177.57000732421875
]
]
}
]
},
{
"name": "Other Foreign Income",
"metadata": {
"currency": "USD"
},
"blocks": [
{
"name": "Interest",
"@entity": "table",
"header": [
"description",
"date",
"amount",
"tds"
],
"rows": [
[
"Interest Q1",
1601447257000,
1.5,
0
],
[
"Interest Q2",
1601447257000,
1.5,
0
]
]
},
{
"name": "Dividends",
"@entity": "table",
"header": [
"isin",
"symbol",
"quantity",
"date",
"dividend_amount",
"tds"
],
"rows": [
[
"INE428A01015",
"GOOGL",
10,
1601447257000,
4,
0
]
]
}
]
}
]
}
'
Test Environment Not Available
Response
The API responds back in a sheet structure. An example response is shown below.
{
"transaction_id": "7e4819d7-d226-4469-b8f5-7cdb2cfa9ada",
"code": 200,
"data": {
"sheets": [
{
"blocks": [
{
"name": "Tradewise P&L",
"header": [
[
"isin",
"symbol",
"quantity",
"buy_date",
"buy_average",
"sell_date",
"sell_average",
"transfer_expenses",
"corporate_action",
"holding_period",
"turnover",
"realized_pnl"
]
],
"rows": [
[
null,
"BHG",
1,
1630598986512,
9.63,
1643380439478,
2.59,
1.05,
null,
"Short Term",
2.59,
-7.04
]
],
"@entity": "table"
},
{
"name": "Tradewise Holdings",
"header": [
[
"isin",
"symbol",
"quantity",
"buy_date",
"buy_average",
"previous_closing_price",
"unrealized_pnl"
]
],
"rows": [
[
null,
"COOL",
0.2,
1626457655107,
9.75,
null,
null
],
[
null,
"STXS",
0.67509531,
1628017687633,
9.01,
null,
null
],
[
null,
"AMZN",
0.00149749,
1628536054329,
3338.92,
null,
null
]
],
"@entity": "table"
},
{
"name": "Metadata",
"header": [
"isin",
"symbol",
"address",
"country",
"zip_code",
"52_week_high",
"closing_value"
],
"rows": [
[
null,
"AAPL",
"ONE APPLE PARK WAY, CUPERTINO, CA 95014",
"United States of America",
"95014",
52,
177.57000732421875
],
[
null,
"AMZN",
"410 TERRY AVENUE NORTH, SEATTLE, WA 98109",
"United States of America",
"98109",
52,
3334.340087890625
],
[
null,
"BHG",
"8000 NORMAN CENTER DRIVE, SUITE 1200, MINNEAPOLIS, MN 55437",
"United States of America",
"55437",
52,
3.440000057220459
],
[
null,
"BTBT",
"136-20 38th Avenue Suite 9A-2 Flushing New York, NY 11354",
"China",
"11354",
52,
6.079999923706055
],
[
null,
"COOL",
"251 LYTTON AVENUE, SUITE 200, PALO ALTO, CA 94301",
"United States of America",
"94301",
52,
9.800000190734863
],
[
null,
"STXS",
"4320 FOREST PARK AVENUE, SUITE 100, ST.LOUIS, MO 63108",
"United States of America",
"63108",
52,
6.199999809265137
],
[
null,
"AAPL",
"ONE APPLE PARK WAY, CUPERTINO, CA 95014",
"United States of America",
"95014",
52,
174.61
],
[
null,
"AMZN",
"410 TERRY AVENUE NORTH, SEATTLE, WA 98109",
"United States of America",
"98109",
52,
3259.95
],
[
null,
"BHG",
"8000 NORMAN CENTER DRIVE, SUITE 1200, MINNEAPOLIS, MN 55437",
"United States of America",
"55437",
52,
1.93
],
[
null,
"BTBT",
"136-20 38th Avenue Suite 9A-2 Flushing New York, NY 11354",
"China",
"11354",
52,
3.6
],
[
null,
"COOL",
"251 LYTTON AVENUE, SUITE 200, PALO ALTO, CA 94301",
"United States of America",
"94301",
52,
9.82
],
[
null,
"STXS",
"4320 FOREST PARK AVENUE, SUITE 100, ST.LOUIS, MO 63108",
"United States of America",
"63108",
52,
3.73
],
[
null,
"AAPL",
"ONE APPLE PARK WAY, CUPERTINO, CA 95014",
"United States of America",
"95014",
52,
174.61
],
[
null,
"AMZN",
"410 TERRY AVENUE NORTH, SEATTLE, WA 98109",
"United States of America",
"98109",
52,
3259.95
],
[
null,
"BHG",
"8000 NORMAN CENTER DRIVE, SUITE 1200, MINNEAPOLIS, MN 55437",
"United States of America",
"55437",
52,
1.93
],
[
null,
"BTBT",
"136-20 38th Avenue Suite 9A-2 Flushing New York, NY 11354",
"China",
"11354",
52,
3.6
],
[
null,
"COOL",
"251 LYTTON AVENUE, SUITE 200, PALO ALTO, CA 94301",
"United States of America",
"94301",
52,
9.82
],
[
null,
"STXS",
"4320 FOREST PARK AVENUE, SUITE 100, ST.LOUIS, MO 63108",
"United States of America",
"63108",
52,
3.73
]
],
"@entity": "table"
},
{
"name": "Capital Gains Summary",
"items": [
[
"ltcg",
0
],
[
"gross_ltcg",
0
],
[
"transfer_expenses_ltcg",
0
],
[
"stcg",
-8.09
],
[
"gross_stcg",
-7.04
],
[
"transfer_expenses_stcg",
1.05
]
],
"@entity": "list"
},
{
"name": "P&L Summary",
"items": [
[
"ltcg",
0
],
[
"stcg",
-8.09
]
],
"@entity": "list"
}
],
"name": "Foreign Equity"
},
{
"blocks": [
{
"name": "Tradewise P&L",
"header": [
[
"isin",
"type",
"symbol",
"quantity",
"buy_date",
"buy_average",
"sell_date",
"sell_average",
"transfer_expenses",
"corporate_action",
"holding_period",
"turnover",
"realized_pnl"
]
],
"rows": [
[
null,
"Equity",
"Vanguard S&P 500 ETF",
35,
1599589800001,
6,
1643804395000,
8.5,
5.083,
null,
"Short Term",
297.5,
87.5
]
],
"@entity": "table"
},
{
"name": "Tradewise Holdings",
"header": [
[
"isin",
"type",
"symbol",
"quantity",
"buy_date",
"buy_average",
"previous_closing_price",
"unrealized_pnl"
]
],
"rows": [
[
null,
"Debt",
"Vanguard Short-Term Bond ETF",
35,
1599589800001,
6,
null,
null
],
[
null,
"Equity",
"Vanguard S&P 500 ETF",
15,
1599589800001,
6,
null,
null
]
],
"@entity": "table"
},
{
"name": "Capital Gains Summary",
"items": [
[
"ltcg",
0
],
[
"gross_ltcg",
0
],
[
"transfer_expenses_ltcg",
0
],
[
"stcg",
82.42
],
[
"gross_stcg",
87.5
],
[
"transfer_expenses_stcg",
5.08
]
],
"@entity": "list"
},
{
"name": "P&L Summary",
"items": [
[
"ltcg",
0
],
[
"stcg",
82.42
]
],
"@entity": "list"
}
],
"name": "Foreign Mutual Funds"
},
{
"blocks": [
{
"name": "Tradewise P&L",
"header": [
[
"isin",
"symbol",
"quantity",
"buy_date",
"buy_average",
"sell_date",
"sell_average",
"transfer_expenses",
"corporate_action",
"holding_period",
"turnover",
"realized_pnl"
]
],
"rows": [],
"@entity": "table"
},
{
"name": "Tradewise Holdings",
"header": [
[
"isin",
"symbol",
"quantity",
"buy_date",
"buy_average",
"previous_closing_price",
"unrealized_pnl"
]
],
"rows": [
[
null,
"Infosys Ltd ADR",
35,
1599589800001,
6,
null,
null
]
],
"@entity": "table"
},
{
"name": "Metadata",
"header": [
"isin",
"symbol",
"address",
"country",
"zip_code",
"52_week_high",
"closing_value"
],
"rows": [
[
null,
"Infosys Ltd ADR",
"ONE APPLE PARK WAY, CUPERTINO, CA 95014",
"United States of America",
"95014",
52,
177.57000732421875
]
],
"@entity": "table"
},
{
"name": "Capital Gains Summary",
"items": [
[
"ltcg",
0
],
[
"gross_ltcg",
0
],
[
"transfer_expenses_ltcg",
0
],
[
"stcg",
0
],
[
"gross_stcg",
0
],
[
"transfer_expenses_stcg",
0
]
],
"@entity": "list"
},
{
"name": "P&L Summary",
"items": [
[
"ltcg",
0
],
[
"stcg",
0
]
],
"@entity": "list"
}
],
"name": "ADR"
},
{
"metadata": {
"currency": "USD"
},
"blocks": [
{
"name": "Interest",
"header": [
"description",
"date",
"amount",
"tds"
],
"rows": [
[
"Interest Q1",
1601447257000,
1.5,
0
],
[
"Interest Q2",
1601447257000,
1.5,
0
]
],
"@entity": "table"
},
{
"name": "Dividends",
"header": [
"isin",
"symbol",
"quantity",
"date",
"dividend_amount",
"tds"
],
"rows": [
[
"INE428A01015",
"GOOGL",
10,
1601447257000,
4,
0
]
],
"@entity": "table"
},
{
"name": "Summary",
"items": [
[
"dividend",
40
],
[
"interest",
1.5
]
],
"@entity": "list"
}
],
"name": "Other Foreign Income"
}
]
},
"timestamp": 1672137403997
}
Response Caching
Response caching is not available for this API. Learn more about our response caching mechanism here
Wallet Charge
Since the Tax P&L Calculator from Tradebook API is not a Paid API, no wallet charge will take place.
Versioning
This API is currently in major version 1.0. Refer to our versioning policies here
Updated 3 months ago