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
dataarray. - Margin fields are returned inside
data. Individual instrument details are returned separately inindividual_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
| Attribute | Data Type | Description |
|---|---|---|
symbol | string | Instrument symbol in FYERS symbology format. |
qty | int | Quantity in units, not lots. Must be a multiple of the lot size for derivatives. |
side | int | 1 = Buy; -1 = Sell. |
type | int | 1 = Limit; 2 = Market; 3 = Stop-market (SL-M); 4 = Stop-limit (SL-L). |
productType | string | Product type for the instrument, such as INTRADAY or MARGIN. |
limitPrice | float | Limit price, where applicable. Use 0.0 for market orders. |
stopLoss | float | Stop-loss value, where applicable. Use 0.0 otherwise. |
Response Attributes
| Attribute | Data Type | Description |
|---|---|---|
s | string | ok / error. |
code | int | API response code. |
message | string | Response or error message. |
data.span | float | Combined SPAN risk margin for the basket. |
data.expo | float | Combined exposure margin for the basket. |
data.total | float | Combined margin requirement: SPAN plus exposure margin. |
data.benefit | float | Margin saving from combining the legs. Already reflected in total; do not subtract it again. |
individual_info | object | Individual margin details, keyed by FYERS instrument token. |
individual_info[token].ltp_info | float | Instrument’s last traded price reported by the calculator. |
individual_info[token].span | float | Individual SPAN margin. |
individual_info[token].expo | float | Individual exposure margin. |
individual_info[token].total | float | Individual total margin. |
Last updated on