Torus Digital Open API
  • Introduction
  • Get Started
  • Authentication
    • Login
    • Session Token
  • SDK
    • Self Generated SDK'S
  • Orders
    • Order Entry
    • Order Modify
    • Order Cancel
    • Order Convert To delivery
    • Order Margin
    • Order Book
    • Order Details
  • Holdings and Portfolio
    • Portfolio
    • Holding
    • Holding Details
    • Net Positions
  • Market
    • Market Status
  • Trade
    • Trade Book
    • Trade Details
  • Funds
    • Fund limits
    • Fund limits details
  • Historical Data
    • Search Stock
    • Company Basic Detail
    • Indices List
    • Monthly/Yearly Returns
    • Share Holding Pattern
    • Balance Sheet
    • Cash Flow
    • Profit and Loss
Powered by GitBook
On this page
  1. Orders

Order Margin

Margin Calculator API delivers the real time margin calculations for a basket of positions.

Endpoint

Base URL
https://connects.torusdigital.com/api/v1/order/calculate/margin

Header Parameters

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Request Parameter

Parameter
Sample/Possible Value
Mandatory
Remarks

exchange

NSE

Y

Exchange

segment

E

Y

In Segment E stands for Equity

security_id

1996

Y

Security ID

txn_type

B

Y

Transaction Type

totalremqty

9

Y

Quantity

price

0.00

Y

Order price (for market pass 0)

product

C

Y

Product

trigger_price

10.00

Y

Trigger price (In case of CO this value should be trigger price of SL leg and in case of BO this value should be absolute)

Request

cURL
curl --location 'https://connects.torusdigital.com/api/v1/order/calculate/margin' \
--header 'Authorization: Bearer {{token}}' \
--header 'Content-Type: application/json' \
--data '{
    "source": "A",
    "data": {
        "security_id": "14366",
        "product": "B",
        "segment": "E",
        "exchange": "NSE",
        "totalremqty": "1",
        "price": "13.00",
        "txn_type": "B",
        "trigger_price":"13.10"
    }
}'
Java-Unirest
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://connects.torusdigital.com/api/v1/order/calculate/margin")
  .header("Authorization", "Bearer {{token}}")
  .header("Content-Type", "application/json")
  .body("{\n" +
        "    \"source\": \"A\",\n" +
        "    \"data\": {\n" +
        "        \"security_id\": \"14366\",\n" +
        "        \"product\": \"B\",\n" +
        "        \"segment\": \"E\",\n" +
        "        \"exchange\": \"NSE\",\n" +
        "        \"totalremqty\": \"1\",\n" +
        "        \"price\": \"13.00\",\n" +
        "        \"txn_type\": \"B\",\n" +
        "        \"trigger_price\": \"13.10\"\n" +
        "    }\n" +
        "}")
  .asString();
Go-Native
package main

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

func main() {
	url := "https://connects.torusdigital.com/api/v1/order/calculate/margin"
	method := "POST"

	payload := strings.NewReader(`{
    "source": "A",
    "data": {
        "security_id": "14366",
        "product": "B",
        "segment": "E",
        "exchange": "NSE",
        "totalremqty": "1",
        "price": "13.00",
        "txn_type": "B",
        "trigger_price": "13.10"
    }
}`)

	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))
}
JavaScript-jQuery
var settings = {
  "url": "https://connects.torusdigital.com/api/v1/order/calculate/margin",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Authorization": "Bearer {{token}}",
    "Content-Type": "application/json"
  },
  "data": JSON.stringify({
    "source": "A",
    "data": {
      "security_id": "14366",
      "product": "B",
      "segment": "E",
      "exchange": "NSE",
      "totalremqty": "1",
      "price": "13.00",
      "txn_type": "B",
      "trigger_price": "13.10"
    }
  }),
};

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

Response

{
    "data": [
        {
            "INSFFBALNC": 0.0,
            "VARELMMARGIN": 0.0,
            "AVAILBALANCE": 10000000.0,
            "BROKERAGE": 0.0,
            "TOTMARGIN": 5292.0,
            "EXPOMARGIN": 0.0,
            "SPANMARGIN": 0.0,
            "BROKER_BROKERAGE": 600,
            "LEVIES_BROKERAGE": 0,
            "OTHER_BROKERAGE": 0
        }
    ],
    "status": "success",
    "message": "Success"
}

Response Parameter

Field
Description

INSFFBALNC

Insufficient balance in the account (floating-point number).

VARELMMARGIN

Variation margin, the funds required to bring the margin balance up to the initial margin during the trading day.

AVAILBALANCE

Available balance in the account (floating-point number).

BROKERAGE

Brokerage fee charged for executing trades or services (floating-point number).

TOTMARGIN

Total margin held in the account, typically required for trading derivatives (floating-point number).

EXPOMARGIN

Exposure margin required for exposure to risks (floating-point number).

SPANMARGIN

SPAN margin determined by exchanges for futures/options contracts (floating-point number).

BROKER_BROKERAGE

Specific type of brokerage fee (integer).

LEVIES_BROKERAGE

Levies or additional charges associated with brokerage (integer).

OTHER_BROKERAGE

Other brokerage-related charges or fees (integer).

PreviousOrder Convert To deliveryNextOrder Book

Last updated 7 months ago