eqEuropeanOptionPricer

语法

eqEuropeanOptionPricer(instrument, pricingDate, spot, discountCurve, dividendCurve, volSurf, [settings])

详情

对权益类欧式期权进行定价。

参数

instrument INSTRUMENT 类型标量或向量,表示需要定价的权益类欧式期权。字段要求参考 Instrument 字段说明

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

spot 数值类型标量或向量,表示现货价格。

discountCurve MKTDATA 标量或向量,表示折现曲线(IrYieldCurve)

dividendCurve MKTDATA 标量或向量,表示股息曲线(DividendCurve)。该曲线通过 eqDividendCurveBuilder 构建。

volSurf VolatilitySurface 对象,表示权益类期权波动率曲面。该曲面由 eqVolatilitySurfaceBuilder 构建。

settings 可选参数,字典(Dictionary<STRING, BOOL>),用于指定是否计算希腊字母(Greeks)所代表的期权价格敏感性指标。可选值:
描述
calcDelta 布尔值,默认为 false 是否计算 Delta,即期权价格相对于标的资产价格的敏感性。
calcGamma 布尔值,默认为 false 是否计算 Gamma,即期权 Delta 相对于标的资产价格的敏感性。
calcVega 布尔值,默认为 false 是否计算 Vega,即期权价格相对于标的资产波动率的敏感性。
calcTheta 布尔值,默认为 false 是否计算 Theta,即期权价格相对于时间变化的敏感性。
calcRhoIr 布尔值,默认为 false 是否计算 RhoIr,即期权价格相对于无风险利率的敏感性。
calcRhoDividend 布尔值,默认为 false 是否计算 RhoDividend,即期权价格相对于股息收益率变化的敏感性。

返回值

  • 若不指定 setting 参数,返回 DOUBLE 类型标量,表示期权的净现值(NPV),即期权的理论价格。
  • 指定 settings 参数时,返回一个字典(Dictionary<STRING, DOUBLE>),包含期权的净现值(NPV)以及希腊字母(Greeks)所代表的期权价格敏感性指标。有关敏感性指标的说明请参考 settings 参数说明。

例子

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 字段说明

字段名 类型 描述 是否必填
productType STRING 固定填 "Option"
optionType STRING 固定填 "EuropeanOption"
assetType STRING 固定填 “EqEuropeanOption"
notionalAmount DOUBLE 名义本金额
notionalCurrency STRING 名义本金货币,默认为 CNY
instrumentId STRING

合约代码,如中证500ETF期权

510500C2512M04800

direction SRTRING 买卖方向 Buy Sell,默认为 Buy
maturity DATE 到期日
strike DOUBLE 执行利率
payoffType STRING 枚举,可选Call和Put
underlying STRING 标的期货合约代码,如 510050
dayCountConvention STRING 日期计数惯例, 可选 "ActualActualISDA", "ActualActualISMA", "Actual365", "Actual360"
discountCurve STRING 定价时参考的贴现曲线名称,人民币存款默认为 "CNY_FR_007"
dividendCurve STRING 定价时参考的股息曲线名称

相关函数:parseInstrumentparseMktDataeqDividendCurveBuildereqVolatilitySurfaceBuilder