eqEuropeanOptionPricer
Syntax
eqEuropeanOptionPricer(instrument, pricingDate, spot, discountCurve,
dividendCurve, volSurf, [settings])
Details
Prices an European equity option.
Parameters
instrument: An INSTRUMENT scalar or vector specifying the European equity options to be priced. For field requirements, see the Instrument field description.
pricingDate: A DATE scalar or vector specifying the pricing date.
spot: A numeric scalar or vector specifying the spot price.
discountCurve: A MKTDATA scalar or vector specifying the discount curve (IrYieldCurve).
dividendCurve: A MKTDATA scalar or vector specifying the dividend curve
(DividendCurve). This curve is built using
eqDividendCurveBuilder.
volSurf: A VolatilitySurface object specifying the equity option volatility
surface. This surface is built using
eqVolatilitySurfaceBuilder.
| Key | Value | Description |
|---|---|---|
| calcDelta | Boolean; defaults to false | Whether to calculate Delta, the sensitivity of the option price to the underlying asset price. |
| calcGamma | Boolean; defaults to false | Whether to calculate Gamma, the sensitivity of Delta to the underlying asset price. |
| calcVega | Boolean; defaults to false | Whether to calculate Vega, the sensitivity of the option price to volatility. |
| calcTheta | Boolean; defaults to false | Whether to calculate Theta, the sensitivity of the option price to the passage of time. |
| calcRhoIr | Boolean; defaults to false | Whether to calculate RhoIr, the sensitivity of the option price to the risk-free interest rate. |
| calcRhoDividend | Boolean; defaults to false | Whether to calculate RhoDividend, the sensitivity of the option price to changes in the dividend yield. |
Returns
- If the settings parameter is not specified, returns a DOUBLE scalar indicating the option’s net present value (NPV), i.e., the theoretical option price.
- If the settings parameter is specified, returns a dictionary (<STRING, DOUBLE>) containing the option’s NPV and the option price sensitivities represented by the Greeks. For details on Greeks, see the description of the settings parameter.
Examples
pricingDate = 2019.07.08
referenceDate = pricingDate
optionDict = {
"productType": "Option",
"optionType": "EuropeanOption",
"assetType": "EqEuropeanOption",
"notionalCurrency": "CNY",
"notionalAmount": 1E6,
"strike": 3.15,
"maturity": 2025.10.28,
"payoffType": "Call",
"dayCountConvention": "Actual365",
"underlying": "TCH"
}
option = parseInstrument(optionDict)
spot = 2.924
termDates = [2019.07.24, 2019.08.28, 2019.09.25, 2019.12.25]
callPrices = matrix(
[0.2806, 0.2326, 0.1861, 0.1424, 0.1016, 0.0698, 0.0457, 0.0281, 0.0098, 0.0038],
[0.2586, 0.2186, 0.1814, 0.1506, 0.1204, 0.0959, 0.0752, 0.0440, 0.0255, 0.0140],
[0.3202, 0.2801, 0.2417, 0.2068, 0.1754, 0.1474, 0.1234, 0.1030, 0.0697, 0.0465],
[0.3731, 0.3366, 0.3032, 0.2721, 0.2441, 0.2182, 0.1935, 0.1717, 0.1337, 0.1030]
)
putPrices = matrix(
[0.0023, 0.0044, 0.0072, 0.0131, 0.0239, 0.0409, 0.0660, 0.1000, 0.1803, 0.2760],
[0.0189, 0.0284, 0.0413, 0.0589, 0.0796, 0.1047, 0.1346, 0.2031, 0.2835, 0.3760],
[0.0240, 0.0340, 0.0456, 0.0604, 0.0785, 0.1004, 0.1234, 0.1545, 0.2202, 0.2964],
[0.0534, 0.0675, 0.0836, 0.1020, 0.1233, 0.1465, 0.1712, 0.1986, 0.2593, 0.3277]
)
strikes = matrix(
[2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.1, 3.2],
[2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.1, 3.2],
[2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.1, 3.2],
[2.65, 2.7, 2.75, 2.8, 2.85, 2.9, 2.95, 3, 3.1, 3.2]
)
discountCurveDict = {
"mktDataType": "Curve",
"curveType": "IrYieldCurve",
"curveName": "CNY_FR_007",
"referenceDate": referenceDate,
"currency": "CNY",
"dayCountConvention": "Actual365",
"compounding": "Continuous",
"interpMethod": "Linear",
"extrapMethod": "Flat",
"dates": [
2019.07.10, 2019.07.16, 2019.10.09, 2020.01.09, 2020.04.09,
2020.07.09, 2021.07.09, 2022.07.11, 2023.07.10, 2024.07.09,
2026.07.09, 2029.07.09
],
"values":[
0.0145994, 0.0229076, 0.0253021, 0.0257565, 0.0259751,
0.0260355, 0.0265336, 0.0272721, 0.0282024, 0.0290231,
0.0304665, 0.0319855
]
}
discountCurve = parseMktData(discountCurveDict)
dividendCurve = eqDividendCurveBuilder(referenceDate, termDates, "CallPutParity", ,
callPrices, putPrices, strikes, spot, discountCurve, "Actual365", "50ETF")
optionExpiries = termDates
strikes = strikes
optionPrices = matrix(
[0.0023, 0.0044, 0.0072, 0.0131, 0.0239, 0.0409, 0.0457, 0.0281, 0.0098, 0.0038],
[0.0189, 0.0284, 0.0413, 0.0589, 0.0796, 0.1047, 0.0752, 0.0440, 0.0255, 0.0140],
[0.0240, 0.0340, 0.0456, 0.0604, 0.0785, 0.1004, 0.1234, 0.1030, 0.0697, 0.0465],
[0.0534, 0.0675, 0.0836, 0.1020, 0.1233, 0.1465, 0.1935, 0.1717, 0.1337, 0.1030]
)
payoffTypes = matrix(
["Put", "Put", "Put", "Put", "Put", "Put", "Call", "Call", "Call", "Call"],
["Put", "Put", "Put", "Put", "Put", "Put", "Call", "Call", "Call", "Call"],
["Put", "Put", "Put", "Put", "Put", "Put", "Call", "Call", "Call", "Call"],
["Put", "Put", "Put", "Put", "Put", "Put", "Call", "Call", "Call", "Call"]
)
volSurface = eqVolatilitySurfaceBuilder(referenceDate, optionExpiries, strikes, optionPrices,
payoffTypes, spot, discountCurve, dividendCurve, "SABR", "50ETF")
npv = eqEuropeanOptionPricer(option, pricingDate, spot, discountCurve, dividendCurve, volSurface)
print(npv)
Instrument Field Description
| Field | Type | Description | Required |
|---|---|---|---|
| productType | STRING | Fixed value: "Option" | Yes |
| optionType | STRING | Fixed value: "EuropeanOption" | Yes |
| assetType | STRING | Fixed value: “EqEuropeanOption" | Yes |
| notionalAmount | DOUBLE | Notional amount | Yes |
| notionalCurrency | STRING | Notional currency. Defaults to CNY. | Yes |
| instrumentId | STRING |
Contract identifier, e.g. CSI 500 ETF option 510500C2512M04800 |
No |
| direction | SRTRING | Trade direction: Buy or Sell. Defaults to Buy. | No |
| maturity | DATE | Maturity date | Yes |
| strike | DOUBLE | Strike price | Yes |
| payoffType | STRING | Enum. Supported values: Call, Put. | Yes |
| underlying | STRING | Underlying contract code, e.g. 510050. | Yes |
| dayCountConvention | STRING | Day count convention. Supported values: "ActualActualISDA", "ActualActualISMA", "Actual365", "Actual360". | Yes |
| discountCurve | STRING | Name of the discount curve used for pricing. Defaults to "CNY_FR_007" for CNY deposits. | No |
| dividendCurve | STRING | Name of the dividend curve used for pricing. | No |
Related Functions: parseInstrument, parseMktData, eqDividendCurveBuilder, eqVolatilitySurfaceBuilder
