Margin calculation

Margin calculation APIs lets you calculate span, exposure, option premium, additional, bo, cash, var, pnl values for a list of orders.

type endpoint  
POST /margins/orders Calculates margins for each order considering the existing positions and open orders
POST /margins/basket Calculates margins for spread orders

Note

Requests to the above endpoints are JSON POST and it needs application/json header.

Order margins

Request order structure
Response margin structure

curl https://api.kite.trade/margins/orders \
    -H 'X-Kite-Version: 3' \
    -H 'Authorization: token api_key:access_token' \
    -H 'Content-Type: application/json' \
    -d '[
    {
        "exchange": "NSE",
        "tradingsymbol": "INFY",
        "transaction_type": "BUY",
        "variety": "regular",
        "product": "CNC",
        "order_type": "MARKET",
        "quantity": 1,
        "price": 0,
        "trigger_price": 0
    }
]'

Query parameters are as follows.

parameter  
mode compact - Compact mode will only give the total margins
{
    "status": "success",
    "data": [
        {
            "type": "equity",
            "tradingsymbol": "INFY",
            "exchange": "NSE",
            "span": 0,
            "exposure": 0,
            "option_premium": 0,
            "additional": 0,
            "bo": 0,
            "cash": 0,
            "var": 961.45,
            "pnl": {
                "realised": 0,
                "unrealised": 0
            },
            "total": 961.45
        }
    ]
}

Order structure

parameter  
exchange Name of the exchange
transaction_type BUY/SELL
variety Order variety (regular, amo, bo, co etc.)
product Margin product to use for the order (margins are blocked based on this) ?
order_type Order type (MARKET, LIMIT etc.)
quantity Quantity of the order
price Price at which the order is going to be placed (LIMIT orders)
trigger_price Trigger price (for SL, SL-M, CO orders)

Margin structure

parameter  
type equity/commodity
tradingsymbol Trading symbol of the instrument
exchange Name of the exchange
span SPAN margins
exposure Exposure margins
option_premium Option premium
additional Additional margins
bo BO margins
cash Cash credit
var VAR
pnl Reliased and unreliased profit and loss
total Total margin block

Basket margins

curl https://api.kite.trade/margins/basket?consider_positions=true \
    -H 'X-Kite-Version: 3' \
    -H 'Authorization: token api_key:access_token' \
    -H 'Content-Type: application/json' \
    -d '[
    {
        "exchange": "NFO",
        "tradingsymbol": "NIFTY20JUL10600CE",
        "transaction_type": "SELL",
        "variety": "regular",
        "product": "NRML",
        "order_type": "MARKET",
        "quantity": 75,
        "price": 0,
        "trigger_price": 0
    },
    {
        "exchange": "NFO",
        "tradingsymbol": "NIFTY20JUL10700CE",
        "transaction_type": "BUY",
        "variety": "regular",
        "product": "NRML",
        "order_type": "MARKET",
        "quantity": 75,
        "price": 0,
        "trigger_price": 0
    }
]'

Query parameters are as follows.

parameter  
consider_positions Boolean to consider users positions
mode compact - Compact mode will only give the total margins
{
  "status": "success",
  "data": {
    "initial": {
      "type": "",
      "tradingsymbol": "",
      "exchange": "",
      "span": 182563.5,
      "exposure": 17407.65,
      "option_premium": 30255,
      "additional": 0,
      "bo": 0,
      "cash": 0,
      "var": 0,
      "pnl": {
        "realised": 0,
        "unrealised": 0
      },
      "total": 230226.15
    },
    "final": {
      "type": "",
      "tradingsymbol": "",
      "exchange": "",
      "span": 7534.5,
      "exposure": 17407.65,
      "option_premium": 30255,
      "additional": 0,
      "bo": 0,
      "cash": 0,
      "var": 0,
      "pnl": {
        "realised": 0,
        "unrealised": 0
      },
      "total": 55197.15
    },
    "orders": [
      {
        "type": "equity",
        "tradingsymbol": "NIFTY20JUL10600CE",
        "exchange": "NFO",
        "span": 182563.5,
        "exposure": 17407.65,
        "option_premium": 0,
        "additional": 0,
        "bo": 0,
        "cash": 0,
        "var": 0,
        "pnl": {
          "realised": 0,
          "unrealised": 0
        },
        "total": 199971.15
      },
      {
        "type": "equity",
        "tradingsymbol": "NIFTY20JUL10700CE",
        "exchange": "NFO",
        "span": 0,
        "exposure": 0,
        "option_premium": 30255,
        "additional": 0,
        "bo": 0,
        "cash": 0,
        "var": 0,
        "pnl": {
          "realised": 0,
          "unrealised": 0
        },
        "total": 30255
      }
    ]
  }
}

Response structure is as follows.

parameter  
initial Total margins required to execute the orders
final Total margins with the spread benefit
orders Individual margins per order