# Net Positions

This API retrieves the net position for a specific account or set of accounts. It provides detailed information on current holdings, positions, and their associated values, allowing users to track and manage their investments effectively.

**Endpoint**

```
https://connects.torusdigital.com/api/v1/holdings/netposition
```

**Header Parameters**

<table><thead><tr><th width="306">Name</th><th>Value</th></tr></thead><tbody><tr><td>Content-Type</td><td><code>application/json</code></td></tr><tr><td>Authorization</td><td><code>Bearer &#x3C;token></code></td></tr></tbody></table>

**Request Parameter**

<table><thead><tr><th>Parameter</th><th width="84">Value</th><th width="127">Mandatory</th><th>Description</th></tr></thead><tbody><tr><td>source</td><td>M</td><td>Y</td><td>Source of the request (e.g., "M")</td></tr><tr><td>interop_flag</td><td>IP</td><td>Y</td><td>Indicates the interoperation flag status (e.g., IP).</td></tr></tbody></table>

**Request**

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

```javascript
curl -X 'POST' \
  'https://connects.torusdigital.com/api/v1/holdings/netposition' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer {{token}}' \
  -H 'Content-Type: application/json' \
  -d '{
  "data": {
    "interop_flag": "IP"
  },
  "source": "M"
}'
```

{% endcode %}
{% endtab %}

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

```java
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://connects.torusdigital.com/api/v1/holdings/netposition")
  .header("Authorization", "Bearer {{token}}")
  .header("Content-Type", "application/json")
  .body("{\n" +
        "    \"source\": \"M\",\n" +
        "    \"data\": {\n" +
        "        \"interop_flag\": \"IP\"\n" +
        "    }\n" +
        "}")
  .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/holdings/netposition"
	method := "POST"
	
	payload := strings.NewReader(`{
         "source": "M",
          "data": {
            "interop_flag": "IP"
           }
        }`)

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

	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/holdings/netposition",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer {{token}}",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({
    "source": "M",
    "data": {
      "interop_flag": "IP"
    }
  }),
};

$.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": "success",
    "message": "Success",
    "data": [
        {
            "symbol": "RELIANCE",
            "net_qty": -1,
            "sell_avg": 2600,
            "buy_avg": 0,
            "gross_val": 2600,
            "instrument": "EQUITY",
            "realised_profit": 0,
            "client_id": "00001",
            "tot_buy_val_cf": 0,
            "tot_sell_qty": 1,
            "last_traded_price": 0,
            "tot_buy_qty_cf": 0,
            "segment": "E",
            "gross_qty": 1,
            "lot_size": 1,
            "security_id": "500325",
            "strike_price": 0,
            "cost_price": 0,
            "tot_sell_val": 2600,
            "product": "C",
            "tot_sell_val_cf": 0,
            "comm_multiplier": 1,
            "net_avg": -2600,
            "expiry_date": "0001-01-01",
            "mtm": 0,
            "rbi_reference_rate": 1,
            "tot_sell_qty_cf": 0,
            "tot_sell_val_day": 2600,
            "tot_buy_val": 0,
            "net_val": 2600,
            "display_name": "Reliance Industries",
            "exchange_inst_name": "ES",
            "cross_cur_flag": "N",
            "tot_buy_val_day": 0,
            "series": "A",
            "tot_sell_qty_day": 1,
            "opt_type": "NA",
            "exchange": "BSE",
            "tot_buy_qty_day": 0,
            "tot_buy_qty": 0,
            "mkt_type": "NL",
            "isin": "INE002A01018"
        }
    ],
}
```

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

**Response Parameter**

<table><thead><tr><th width="237">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>symbol</td><td>The stock symbol or code for the holding (e.g., "RELIANCE").</td></tr><tr><td>net_qty</td><td>The net quantity of the stock held (negative for short positions).</td></tr><tr><td>sell_avg</td><td>The average sell price of the stock.</td></tr><tr><td>buy_avg</td><td>The average buy price of the stock.</td></tr><tr><td>gross_val</td><td>The gross value of the position.</td></tr><tr><td>instrument</td><td>The type of instrument (e.g., "EQUITY").</td></tr><tr><td>realised_profit</td><td>The realized profit from the position.</td></tr><tr><td>client_id</td><td>The client identifier.</td></tr><tr><td>tot_buy_val_cf</td><td>The total buy value carried forward.</td></tr><tr><td>tot_sell_qty</td><td>The total sell quantity.</td></tr><tr><td>last_traded_price</td><td>The last traded price of the stock.</td></tr><tr><td>tot_buy_qty_cf</td><td>The total buy quantity carried forward.</td></tr><tr><td>segment</td><td>The segment of the stock (e.g., "E" for Equity).</td></tr><tr><td>gross_qty</td><td>The gross quantity of the stock.</td></tr><tr><td>lot_size</td><td>The lot size for the instrument.</td></tr><tr><td>security_id</td><td>The security ID of the stock (e.g., "500325" for Reliance Industries).</td></tr><tr><td>strike_price</td><td>The strike price for options (0 if not applicable).</td></tr><tr><td>cost_price</td><td>The cost price of the stock.</td></tr><tr><td>tot_sell_val</td><td>The total sell value of the position.</td></tr><tr><td>product</td><td>The product type (e.g., "C" for Cash).</td></tr><tr><td>tot_sell_val_cf</td><td>The total sell value carried forward.</td></tr><tr><td>comm_multiplier</td><td>The commission multiplier.</td></tr><tr><td>net_avg</td><td>The net average value of the position.</td></tr><tr><td>expiry_date</td><td>The expiry date for derivative contracts (default value if not applicable).</td></tr><tr><td>mtm</td><td>The mark-to-market value of the position.</td></tr><tr><td>rbi_reference_rate</td><td>The RBI reference rate.</td></tr><tr><td>tot_sell_qty_cf</td><td>The total sell quantity carried forward.</td></tr><tr><td>tot_sell_val_day</td><td>The total sell value for the day.</td></tr><tr><td>tot_buy_val</td><td>The total buy value of the position.</td></tr><tr><td>net_val</td><td>The net value of the position.</td></tr><tr><td>display_name</td><td>The display name of the stock (e.g., "Reliance Industries").</td></tr><tr><td>exchange_inst_name</td><td>The exchange and instrument name.</td></tr><tr><td>cross_cur_flag</td><td>The cross-currency flag status (e.g., "N").</td></tr><tr><td>tot_buy_val_day</td><td>The total buy value for the day.</td></tr><tr><td>series</td><td>The series of the stock (e.g., "A").</td></tr><tr><td>tot_sell_qty_day</td><td>The total sell quantity for the day.</td></tr><tr><td>opt_type</td><td>The option type (e.g., "NA" if not applicable).</td></tr><tr><td>exchange</td><td>The exchange where the stock is traded (e.g., "BSE" / NSE).</td></tr><tr><td>tot_buy_qty_day</td><td>The total buy quantity for the day.</td></tr><tr><td>tot_buy_qty</td><td>The total buy quantity of the position.</td></tr><tr><td>mkt_type</td><td>The market type (e.g., "NL" for normal).</td></tr><tr><td>isin</td><td>The ISIN (International Securities Identification Number) of the stock (e.g., "INE002A01018").</td></tr></tbody></table>
