cmFutEuropeanOptionPricer
Syntax
cmFutEuropeanOptionPricer(instrument, pricingDate, futPrice, discountCurve,
futPriceCurve, volSurf, [setting], [model], [method])
Details
Prices European commodity futures options.
Parameters
instrument: An INSTRUMENT scalar or vector specifying the European commodity futures options to be priced.
pricingDate: A DATE scalar or vector specifying the pricing date.
futPrice: A DOUBLE scalar or vector specifying the futures price of the underlying contract at the pricing date.
discountCurve: A MKTDATA scalar or vector specifying the discount curve (IrYieldCurve).
futPriceCurve: A MKTDATA scalar or vector specifying the futures price curve (AssetPriceCurve).
volSurf: A MKTDATA scalar or vector specifying the volatility surface
(VolatilitySurface). The surface is built using
cmFutVolatilitySurfaceBuilder.
| 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. |
| calcRho | Boolean; defaults to false | Whether to calculate Rho, the sensitivity of the option price to the risk-free interest rate. |
model (optional): A STRING scalar. The default and only supported value is "Black76", indicating that the Black-76 model is used.
method (optional): A STRING scalar. The default and only supported value is "Analytic", indicating that an analytical method is used.
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
spot = 2800.0
strike = spot * 1.2
nominal = 1.0
// Discount curve (CNY FR007) — zero rates
discountCurveInfo = {
"mktDataType": "Curve",
"curveType": "IrYieldCurve",
"referenceDate": pricingDate,
"currency": "CNY",
"dayCountConvention": "Actual365",
"compounding": "Continuous",
"interpMethod": "Linear",
"extrapMethod": "Flat",
"frequency": "Annual",
"dates": [pricingDate+2, pricingDate+8, pricingDate+93, pricingDate+185, pricingDate+276, pricingDate+367,
pricingDate+732, pricingDate+1099, pricingDate+1463, pricingDate+1828, pricingDate+2558, pricingDate+3654],
"values": [0.0145993931630537, 0.0229075517972275, 0.0253020667393029, 0.0257564866303201,
0.0259751440992468, 0.0260355181479988, 0.0265336263144786, 0.0272721454114050,
0.0282024453631075, 0.0290231222075799, 0.0304665029488732, 0.0319855013976250]
}
discountCurve = parseMktData(discountCurveInfo)
// Futures price curve (Soymeal)
futPriceCurveInfo = {
"mktDataType": "Curve",
"curveType": "AssetPriceCurve",
"referenceDate": pricingDate,
"currency": "CNY",
"asset": "SOY_MEAL",
"interpMethod": "Linear",
"extrapMethod": "Flat",
"dates": [2019.09.16, 2019.11.14, 2019.12.13, 2020.01.15, 2020.03.13],
"values": [2784, 2821, 2772, 2847, 2775]
}
futPriceCurve = parseMktData(futPriceCurveInfo)
// Option expiries, futures maturities, strikes, market prices, payoff types
optionExpiries = [2019.08.07, 2019.10.11, 2019.11.07, 2019.12.06, 2020.02.07]
futMaturities = [2019.09.16, 2019.11.14, 2019.12.13, 2020.01.15, 2020.03.13]
strikes = [
[2600,2650,2700,2750,2800,2850,2900,2950,3000,3050],
[2600,2650,2700,2750,2800,2850,2900,2950,3000,3050],
[2650,2700,2750,2800,2850,2900,2950,3000],
[2650,2700,2750,2800,2850,2900,2950,3000],
[2600,2650,2700,2750,2800,2850,2900]
]
optionPrices = [
[9,17,30,48.5,57,37.5,23,13.5,7.5,4],
[29,41.5,56.5,75.5,98,95.5,75,58.5,44.5,33.5],
[50,68.5,90.5,89,69,52.5,39,29],
[56,72,91,113,134.5,112.5,93,76.5],
[58.5,75.5,95,118,119.5,98.5,80.5]
]
payoffTypes = [
["Put","Put","Put","Put","Call","Call","Call","Call","Call","Call"],
["Put","Put","Put","Put","Put","Call","Call","Call","Call","Call"],
["Put","Put","Put","Call","Call","Call","Call","Call"],
["Put","Put","Put","Put","Call","Call","Call","Call"],
["Put","Put","Put","Put","Call","Call","Call"]
]
// Build vol surface from quotes
volSurf = cmFutVolatilitySurfaceBuilder(pricingDate, futMaturities, optionExpiries, strikes, optionPrices, payoffTypes, discountCurve, futPriceCurve)
print(volSurf)
// Instrument
cmFutEuropeanOption = {
"productType": "Option",
"optionType": "EuropeanOption",
"assetType": "CmFutEuropeanOption",
"instrumentId": "SOYMEAL_CALL",
"notionalAmount": nominal,
"notionalCurrency": "CNY",
"strike": strike,
"maturity": pricingDate + 180,
"payoffType": "Call",
"dayCountConvention": "Actual365",
"underlying": "SOY_MEAL",
"domesticCurve": "CNY_FR_007"
}
instrument = parseInstrument(cmFutEuropeanOption)
// Price
result = cmFutEuropeanOptionPricer(instrument, pricingDate, spot, discountCurve, volSurf)
Related Functions: parseMktData, parseInstrument, cmFutVolatilitySurfaceBuilder
