Skip to content

Margin Calculation


The Margin endpoints retrieve the margin requirements as well Charges that will be levied for specific trading positions or instruments.

Type Endpoint Description
POST /margin/order Calculates margin and charges for each order taking into consideration existing positions and open orders
POST /margin/basket Calculates margin and charges for Basket orders

Order Margin

The following API is used to calculate the margin required for a particular order and the detailed charges associated with the order

Sample Request
curl --location 'https://api.tiqs.trading/margin/order' \
--header 'appId: <YOUR_APP_ID>' \
--header 'token: <YOUR_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
    "exchange": "NFO",
    "token": "72734",
    "quantity": "25",
    "product": "M",
    "price": "905",
    "transactionType": "S",
    "order": "LMT"
}'
Sample Response
{
  "data": {
    "cash": "276006.43",
    "charge": {
      "brokerage": 20,
      "sebiCharges": 0.00309225,
      "exchangeTxnFee": 1.546125,
      "stampDuty": 0.0927675,
      "ipft": 0.015461250000000001,
      "transactionTax": 0,
      "gst": {
        "cgst": 0,
        "sgst": 0,
        "igst": 3.8816421300000004,
        "total": 3.8816421300000004
      },
      "total": 25.523626880000002
    },
    "margin": "3125.00",
    "marginUsed": "3125.00"
  },
  "status": "success"
}

Basket Margin

The following API is used to calculate the margin required for a basket. This API expects a list of instruments to calculate the margin.

Note

The above API can be used to calculate the margin of a single instrument too, but there won't be list of charges available and the RMS uses a different type of Calculation for basket margin hence for a single instrument, the margin shown could be a bit different from what Order Margin API will give. We therefore recommend to use the order margin API for a single instrument.

Sample Request
curl --location 'https://api.tiqs.trading/margin/basket' \
--header 'appId: <YOUR_APP_ID>' \
--header 'token: <YOUR_TOKEN>' \
--data '[
    {
        "exchange": "NFO",
        "token": "51641",
        "quantity": "900",
        "price": "133.5",
        "triggerPrice": "0",
        "product": "M",
        "transactionType": "B",
        "order": "LMT"
    },
    {
        "exchange": "NFO",
        "token": "46283",
        "quantity": "900",
        "price": "132",
        "triggerPrice": "0",
        "product": "M",
        "transactionType": "S",
        "order": "LMT"
    }
]'
Sample Response
{
  "data": {
    "marginUsed": "343086.95",
    "marginUsedAfterTrade": "224261.95"
  },
  "status": "success"
}