Skip to Content
API ReferenceMargin CalculatorSPAN Margin Calculator

SPAN Margin Calculator

This API allows you to calculate the combined SPAN and exposure margin for futures and options, including margin benefits from hedges and individual instrument margin details.

USE CASE

Compare hedged and unhedged strategies and understand the margin required for the combined basket.

Note

A maximum of 20 symbols is allowed per request. Each entry in the data array counts towards this limit. Zero SPAN margin for bought options does not mean zero premium cost.

Details

  • Pass the instrument details inside a data array.
  • Margin fields are returned inside data. Individual instrument details are returned separately in individual_info.
  • The example buys OTM hedges before selling ATM options.
  • Rate limits differ between the Standard and Prime plans. See Plans & rate limits.

Request Attributes

AttributeData TypeDescription
symbolstringInstrument symbol in FYERS symbology format.
qtyintQuantity in units, not lots. Must be a multiple of the lot size for derivatives.
sideint1 = Buy; -1 = Sell.
typeint1 = Limit; 2 = Market; 3 = Stop-market (SL-M); 4 = Stop-limit (SL-L).
productTypestringProduct type for the instrument, such as INTRADAY or MARGIN.
limitPricefloatLimit price, where applicable. Use 0.0 for market orders.
stopLossfloatStop-loss value, where applicable. Use 0.0 otherwise.

Response Attributes

AttributeData TypeDescription
sstringok / error.
codeintAPI response code.
messagestringResponse or error message.
data.spanfloatCombined SPAN risk margin for the basket.
data.expofloatCombined exposure margin for the basket.
data.totalfloatCombined margin requirement: SPAN plus exposure margin.
data.benefitfloatMargin saving from combining the legs. Already reflected in total; do not subtract it again.
individual_infoobjectIndividual margin details, keyed by FYERS instrument token.
individual_info[token].ltp_infofloatInstrument’s last traded price reported by the calculator.
individual_info[token].spanfloatIndividual SPAN margin.
individual_info[token].expofloatIndividual exposure margin.
individual_info[token].totalfloatIndividual total margin.
Last updated on