# Portfolio

The Portfolio API provides access to detailed information about an investment portfolio. It allows clients to retrieve a comprehensive view of a portfolio and is useful for portfolio management systems, financial institutions, and individual investors.

**Endpoint**

{% code title="Base URL" overflow="wrap" fullWidth="false" %}

```
https://connects.torusdigital.com/api/v1/portfolio/
```

{% endcode %}

**Header Parameters**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Request**

{% tabs %}
{% tab title="curl" %}
{% code title="cURL" overflow="wrap" lineNumbers="true" %}

```javascript
curl -X 'GET' \
'https://connects.torusdigital.com/api/v1/portfolio' \
-H 'accept: application/json' \
-H 'Authorization: Bearer {{token}}'\
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code title="Java-Unirest" fullWidth="false" %}

```java
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://connects.torusdigital.com/api/v1/portfolio/")
  .header("Authorization", "Bearer {{token}}")
  .header("Content-Type", "application/json")
  .asString();
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code title="Go-Native" overflow="wrap" lineNumbers="true" fullWidth="true" %}

```go
package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"strings"
)

func main() {
	url := "https://connects.torusdigital.com/api/v1/portfolio/"
	method := "GET"

	client := &http.Client{}
	req, err := http.NewRequest(method, url, nil)

	if err != nil {
		fmt.Println(err)
		return
	}
	req.Header.Add("Authorization", "Bearer {{token}}")
	req.Header.Add("Content-Type", "application/json")

	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(string(body))
}
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code title="JavaScript-jQuery" overflow="wrap" lineNumbers="true" %}

```javascript
var settings = {
  "url": "https://connects.torusdigital.com/api/v1/portfolio/",
  "method": "GET",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer {{token}}",
    "Content-Type": "application/json"
  },
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
```

{% endcode %}
{% endtab %}
{% endtabs %}

**Response**

{% tabs %}
{% tab title="200" %}
{% code overflow="wrap" lineNumbers="true" fullWidth="true" %}

```json
{
    "status": "S",
    "message": "SUCCESS",
    "lastUpdatedOn": null,
    "url": "",
    "id": null,
    "userID": null,
    "data": [
        {
            "ScripID": 0,
            "L3_ClientID": 0,
            "L4_AccountTypeID": 1,
            "L5_AccountID": 4,
            "ProcessDate": "2024-09-16T00:00:00",
            "AssetClassID": 14,
            "ID": 0,
            "ScripName": "Vodafone Idea Ltd",
            "MaturityDate": "",
            "Units": 3.000,
            "PurchaseNav": 29.157,
            "ValueAtcost": 87.47,
            "CurrentNAV": 13.410,
            "CurrentMarketValuation": 40,
            "Dividend": 0.0000,
            "AbsoluteGainOrLoss": -47.24,
            "AbsoluteGainORLossPercentage": -117.4,
            "XIRR": -74.4,
            "AvgDaysInvested": 50,
            "Category": "Direct Equity",
            "SIP": 0.00,
            "AsonDate": "13 Sep 2024",
            "realizedGainLossValue": 0.0000,
            "realizedGainLossPercentage": 0.00,
            "NetPL": -47.24,
            "DividendPayout": 0.00,
            "currentValuePercentage": 100.0,
            "CategorycurrentValuePercentage": 100.0,
            "TotalXIRR": -74.4,
            "CategoryXIRR": -74.4,
            "TotalDividend": 0.00,
            "TotalNetPl": -47.24,
            "CategoryDividend": 0.00,
            "CategoryNetPl": -47.24,
            "TotalValuetAtCost": 87.47,
            "CategoryValuetAtCost": 87.47,
            "TotalMarketValue": 40.00,
            "CategoryMarketValue": 40.23,
            "CategoryAbsoluteGainOrLoss": -47.24,
            "TotalAbsoluteGainOrLoss": -47.24,
            "UCC": "",
            "ISIN": "ISINNumber",
            "StrCategoryXIRR": "-74.4",
            "PurchaseAllowed": true,
            "RedemptionAllowed": true,
            "STPAllowed": true,
            "SwitchAllowed": true,
            "SWPAllowed": false
        }
    ],
    "table1": null,
    "table2": null,
    "table3": null,
    "table4": null,
    "table5": null,
    "table6": null,
    "table7": null,
    "table8": null,
    "table9": null,
    "table10": null,
    "table11": null,
    "table12": null
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

**Response Parameter**

<table><thead><tr><th width="301">Parameter</th><th></th></tr></thead><tbody><tr><td>status</td><td>Status of the API response, e.g., "S" for Success.</td></tr><tr><td>message</td><td>Message describing the status, e.g., "SUCCESS".</td></tr><tr><td>lastUpdatedOn</td><td>Timestamp of when the portfolio was last updated, if available.</td></tr><tr><td>url</td><td>A URL for further details or related resources (if applicable).</td></tr><tr><td>id</td><td>A unique identifier for the portfolio (if available).</td></tr><tr><td>userID</td><td>Unique identifier for the user (if applicable).</td></tr><tr><td>data</td><td>Array of portfolio data objects containing detailed information about each asset in the portfolio.</td></tr><tr><td>ScriptID</td><td>Unique identifier for the asset (scrip) in the portfolio.</td></tr><tr><td>L3_ClientID</td><td>Level 3 client ID associated with the portfolio (if applicable).</td></tr><tr><td>L4_AccountTypeID</td><td>Level 4 account type identifier for the portfolio, e.g., type of account holding the asset.</td></tr><tr><td>L5_AccountID</td><td>Level 5 account identifier for the specific account holding the asset.</td></tr><tr><td>ProcessDate</td><td>Date when the data was processed, in ISO 8601 format (e.g., "2024-09-16T00:00:00").</td></tr><tr><td>AssetClassID</td><td>Identifier for the asset class of the holding (e.g., stocks, bonds, etc.).</td></tr><tr><td>ID</td><td>Unique identifier for the portfolio entry.</td></tr><tr><td>ScripName</td><td>Name of the asset or company (e.g., "Vodafone Idea Ltd").</td></tr><tr><td>MaturityDate</td><td>Maturity date for assets like bonds or fixed deposits (if applicable).</td></tr><tr><td>Units</td><td>Number of units of the asset held in the portfolio.</td></tr><tr><td>PurchaseNav</td><td>Net Asset Value (NAV) or price at which the asset was purchased.</td></tr><tr><td>ValueAtcost</td><td>Value of the asset at the time of purchase (at cost).</td></tr><tr><td>CurrentNAV</td><td>Current Net Asset Value or price of the asset.</td></tr><tr><td>CurrentMarketValuation</td><td>Current market value of the asset based on its price/NAV.</td></tr><tr><td>Dividend</td><td>Total dividends received from the asset.</td></tr><tr><td>AbsoluteGainOrLoass</td><td>Absolute gain or loss for the asset in terms of currency value.</td></tr><tr><td>AbsoluteGainOrLoassPercentage</td><td>Absolute percentage gain or loss for the asset.</td></tr><tr><td>XIPR</td><td>Extended Internal Rate of Return (XIRR) for the asset, showing its annualized performance.</td></tr><tr><td>AvgDaysInvested</td><td>Average number of days the asset has been held in the portfolio.</td></tr><tr><td>Category</td><td>Category of the asset (e.g., "Direct Equity").</td></tr><tr><td>SIP</td><td>Amount invested through a Systematic Investment Plan (SIP), if applicable.</td></tr><tr><td>AsonDate</td><td>Date for which the portfolio data is applicable.</td></tr><tr><td>realizedGainLossValue</td><td>Realized gain or loss in currency for the asset.</td></tr><tr><td>realizedGainLossValuePercentage</td><td>Realized gain or loss in percentage for the asset.</td></tr><tr><td>NetPL</td><td>Net profit or loss for the asset.</td></tr><tr><td>DividendPayout</td><td>Total dividend payout received for the asset.</td></tr><tr><td>currentValuePercentage</td><td>Percentage of the portfolio's total current value that this asset represents.</td></tr><tr><td>CategorycurrentValuePercentage</td><td>Percentage of the asset class (category) current value relative to the portfolio.</td></tr><tr><td>TotalXIRR</td><td>Total XIRR of the asset, showing its overall performance.</td></tr><tr><td>CategoryXIRR</td><td>XIRR specific to the asset's category.</td></tr><tr><td>TotalDividend</td><td>Total dividends received across all holdings of this asset.</td></tr><tr><td>TotalNetPl</td><td>Total net profit or loss for the asset.</td></tr><tr><td>CategoryDividend</td><td>Total dividends received for the asset class (category).</td></tr><tr><td>CatogoryNetPl</td><td>Net profit or loss for the asset class (category).</td></tr><tr><td>TotalValuetAtCost</td><td>Total value of the asset class (category) at the time of purchase (at cost).</td></tr><tr><td>CategoryValuetAtCost</td><td>Value of the specific asset class at cost.</td></tr><tr><td>TotalMarketValue</td><td>Total current market value for the asset.</td></tr><tr><td>CategoryMarketValue</td><td>Current market value of the asset class.</td></tr><tr><td>CategoryAbsoluteGainOrLoss</td><td>Absolute gain or loss for the asset class.</td></tr><tr><td>TotalAbsoluteGainOrLoss</td><td>Absolute gain or loss for the total portfolio.</td></tr><tr><td>UCC</td><td>Unique Client Code.</td></tr><tr><td>ISIN</td><td>International Securities Identification Number for the asset.</td></tr><tr><td>StrCategoryXIRR</td><td>String representation of the XIRR for the asset's category.</td></tr><tr><td>PurchaseAllowed</td><td>Boolean indicating whether the asset can be purchased.</td></tr><tr><td>RedemptionAllowed</td><td>Boolean indicating whether the asset can be redeemed.</td></tr><tr><td>STPAllowed</td><td>Boolean indicating whether Systematic Transfer Plans (STP) are allowed for the asset.</td></tr><tr><td>SwitchAllowed</td><td>Boolean indicating whether the asset can be switched (to another fund or asset).</td></tr><tr><td>SWPAllowed</td><td>Boolean indicating whether Systematic Withdrawal Plans (SWP) are allowed for the asset.</td></tr><tr><td>table1 to table12</td><td>Placeholder tables for additional data (if any).</td></tr></tbody></table>
