cmFutAmericanOptionPricer

Syntax

cmFutAmericanOptionPricer(instrument, pricingDate, futPrice, discountCurve, volSurf, [setting], [model], [method])

Details

Prices American commodity futures options.

Parameters

instrument: An INSTRUMENT scalar or vector specifying the American commodity futures options to be priced.

pricingDate: A DATE scalar or vector specifying the pricing date.

futPrice: A DOUBLE scalar or vector specifying the current price of the underlying futures contract.

domesticCurve: A MKTDATA scalar or vector specifying the domestic discount curve.

volSurf : A MKTDATA scalar or vector specifying the volatility surface.

setting (optional): A dictionary used to configure pricing outputs. It supports the following keys:

  • calcDelta: Set a boolean value to specify whether to calculate delta.

  • calcGamma: Set a boolean value to specify whether to calculate gamma.

  • calcVega: Set a boolean value to specify whether to calculate vega.

  • calcTheta: Set a boolean value to specify whether to calculate theta.

  • calcRho: Set a boolean value to specify whether to calculate rho.

model (optional): A STRING scalar specifying the pricing model to use. Valid values:

  • "Black76": Black 76 formula

  • "BAW" (default): Barone-Adesi-Whaley formula

method (optional): A STRING scalar specifying the calculation method. Valid values:

  • "Analytic" (default): Analytic method

Returns

  • If setting is not specified, returns a DOUBLE scalar indicating the net present value (NPV) of the option.

  • If setting is specified, returns a dictionary containing the NPV and the Greeks as specified in setting .

Examples

// Test: Soymeal future American call
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
cmFutAmericanOption = {
    "productType": "Option",
    "optionType": "AmericanOption",
    "assetType": "CmFutAmericanOption",
    "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(cmFutAmericanOption)
// Price
result = cmFutAmericanOptionPricer(instrument, pricingDate, spot, discountCurve, volSurf, model="BAW")

Field requirements

Field Name Type Description Required
productType STRING Fixed value: "Option" Yes
optionType STRING Fixed value: "AmericanOption" Yes
assetType STRING Fixed value: "CmFutAmericanOption" Yes
notionalAmount DOUBLE Notional principal amount Yes
notionalCurrency STRING Notional currency Yes
instrumentId STRING Contract code, standard format: Underlying futures contract code + Contract expiry month + Option type code + Strike price, e.g., Sugar option SR2509P6300 = SR+2509+P+6300 No
direction STRING Trading direction. Valid values: “Buy” (default), “Sell”. No
maturity DATE Maturity date Yes
strike DOUBLE Strike price Yes
payoffType STRING Payoff type. Valid values: “Call”, “Put” Yes
underlying STRING Underlying futures contract code, e.g., SR2509 Yes
dayCountConvention STRING Day count convention. Valid values: "ActualActualISDA", "ActualActualISMA", "Actual365", "Actual360" Yes
discountCurve STRING Discount curve name for pricing reference. The default valud for RMB deposits is "CNY_FR_007". No

Related Functions: parseInstrument, parseMktData, cmFutVolatilitySurfaceBuilder