cmFutAmericanOptionPricer

语法

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

详情

对商品期货美式期权进行定价。

参数

instrument INSTRUMENT 类型标量或向量 ,表示待定价的商品期货美式期权。商品期货美式期权所需的关键字段详见产品字段要求。

pricingDate DATE 类型标量或向量,表示定价日期。

futPrice DOUBLE 类型标量或向量,表示标的期货的现价。

domesticCurve MKTDATA 类型(IrYieldCurve)的标量或向量,表示折现曲线。

volSurf MKTDATA 类型(VolatilitySurface)的标量或向量,表示波动率曲面。

setting 可选参数,一个字典,用于设置定价输出。包含以下 key:

  • calcDelta:value 是布尔值,指定是否计算 delta

  • calcGamma:value 是布尔值,指定是否计算 gamma

  • calcVega:value 是布尔值,指定是否计算 vega

  • calcTheta:value 是布尔值,指定是否计算 theta

  • calcRho:value 是布尔值,指定是否计算 rho

model 可选参数,STRING 类型标量,表示使用的模型。可选值为:
  • “Black76”:Black76 公式

  • “BAW”(默认值):Barone-Adesi-Whaley公式

method 可选参数,STRING 类型标量,表示使用的方法。可选值为:
  • “Analytic”(默认值):解析法

返回值

  • 当未指定 setting 时:返回 DOUBLE 类型标量,表示期权的净现值(NPV)。

  • 当指定 setting 时:返回一个字典,包含 NPV 及按 setting 指定的 Greeks 结果。

例子

// 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")

产品字段说明

字段名 类型 描述 是否必填
productType STRING 固定填 "Option"
optionType STRING 固定填 "AmericanOption"
assetType STRING 固定填 "CmFutAmericanOption"
notionalAmount DOUBLE 名义本金额
notionalCurrency STRING 名义本金货币
instrumentId STRING 合约代码,标准格式为:标的期货合约代码+合约到期月份+期权类型代码+行权价格,如白糖期权为 SR2509P6300 = SR+2509+P+6300
direction SRTRING 买卖方向,可选值为 Buy,Sell。默认值为 Buy。
maturity DATE 到期日
strike DOUBLE 执行利率
payoffType STRING 收益类型,可选 Call 和 Put
underlying STRING 标的期货合约代码,如 SR2509
dayCountConvention STRING 日期计数惯例, 可选 "ActualActualISDA", "ActualActualISMA", "Actual365", "Actual360"
discountCurve STRING 定价时参考的贴现曲线名称,人民币存款默认为 "CNY_FR_007"

相关函数: parseInstrumentparseMktDatacmFutVolatilitySurfaceBuilder