Skip to main content

Margin Details

This API provides the functionality to retrieve the margin for an instrument. It accepts input parameters like the instrument, quantity, transaction_type and product.

Margin fields that are not applicable will be set to zero for a given instrument. A maximum of 20 instruments is allowed per request

Request

curl -X 'POST' \
'https://api.upstox.com/v2/charges/margin' \
-H 'accept: application/json' \
-H 'Authorization: Bearer {your_access_token}' \
-H 'Content-Type: application/json' \
-d '{
"instruments": [
{
"instrument_key": "NSE_EQ|INE669E01016",
"quantity": 1,
"transaction_type": "BUY",
"product": "D"

}
]
}'

Additional samples in various languages are available in the Sample Code section on this page.

Request Body

NameRequiredTypeDescription
instrumentstruearrayRequest instruments for margin details.
instruments[].instrument_keytruestringKey of the instrument. For the regex pattern applicable to this field, see the Field Pattern Appendix.
instruments[].quantitytrueinteger (int32)Quantity with which the order is to be placed. It should be multiple of lot size.
instruments[].producttruestringProduct with which the order is to be placed.
Possible values: I, D, CO, MTF.
instruments[].transaction_typetruestringIndicates whether its a buy or sell order.
Possible values: BUY, SELL.
instruments[].pricefalsenumber (float)Price with which the order is to be placed
Responses

Response Body

{
"status": "success",
"data": {
"margins": [
{
"span_margin": 0,
"exposure_margin": 0,
"equity_margin": 33.6,
"net_buy_premium": 0,
"additional_margin": 0,
"total_margin": 33.6,
"tender_margin": 0
}
],
"required_margin": 33.6,
"final_margin": 33.6
}
}

Field Description

NameTypeDescription
statusstringA string indicating the outcome of the request. Typically success for successful operations.
dataobjectResponse data for margin
data.required_marginfloatTotal margin required to execute the orders.
data.final_marginfloatTotal margin after margin benefit.
data.marginsarrayResponse data for instrument margin. details.
data.margins[].equity_marginfloatMargin applicable for any equity trades
data.margins[].total_marginfloatTotal margin required for the basket.
It will be applicable for all the segments.
data.margins[].exposure_marginfloatExposure margin - Based on ELM percentage values provided by exchange.
It will be applicable only on FNO trades.
data.margins[].tender_marginfloatTender margin - It is applicable as the futures contract approaches its expiration date.
data.margins[].span_marginfloatSpan Margin - Upfront margin mandatory by exchange for derivatives trade.
It will be applicable only on FNO trades.
data.margins[].net_buy_premiumfloatNet Buy Premium - Option premium required.
data.margins[].additional_marginfloatAdditional margin - Application margin applicable on MCX FNO trade for certain commodities.

Sample Code

Equity delivery orders

curl -X 'POST' \
'https://api.upstox.com/v2/charges/margin' \
-H 'accept: application/json' \
-H 'Authorization: Bearer {your_access_token}' \
-H 'Content-Type: application/json' \
-d '{
"instruments": [
{
"instrument_key": "NSE_EQ|INE669E01016",
"quantity": 1,
"transaction_type": "BUY",
"product": "D"

}
]
}'

Future delivery orders

curl -X 'POST' \
'https://api.upstox.com/v2/charges/margin' \
-H 'accept: application/json' \
-H 'Authorization: Bearer {your_access_token}' \
-H 'Content-Type: application/json' \
-d '{
"instruments": [
{
"instrument_key": "NSE_FO|35000",
"quantity": 1,
"transaction_type": "BUY",
"product": "D"

}
]
}'

Option delivery orders

curl -X 'POST' \
'https://api.upstox.com/v2/charges/margin' \
-H 'accept: application/json' \
-H 'Authorization: Bearer {your_access_token}' \
-H 'Content-Type: application/json' \
-d '{
"instruments": [
{
"instrument_key": "NSE_FO|54524",
"quantity": 1,
"transaction_type": "BUY",
"product": "D"

}
]
}'

MCX delivery orders

curl -X 'POST' \
'https://api.upstox.com/v2/charges/margin' \
-H 'accept: application/json' \
-H 'Authorization: Bearer {your_access_token}' \
-H 'Content-Type: application/json' \
-d '{
"instruments": [
{
"instrument_key": "MCX_FO|435356",
"quantity": 1,
"transaction_type": "BUY",
"product": "D"

}
]
}'

Currency delivery orders

curl -X 'POST' \
'https://api.upstox.com/v2/charges/margin' \
-H 'accept: application/json' \
-H 'Authorization: Bearer {your_access_token}' \
-H 'Content-Type: application/json' \
-d '{
"instruments": [
{
"instrument_key": "NCD_FO|15758",
"quantity": 1,
"transaction_type": "BUY",
"product": "D"

}
]
}'
Loading...