简单期权相关函数
大约 7 分钟
简单期权相关函数
构建函数
Excel: =McpVanillaOption(args1, args2, args3, args4, args5, fmt)
Python: McpVanillaOption(*args)
- 功能:构造 McpVanillaOption 对象。
- 参数:
args1~args5或*args:参数组,支持以下三种传参方式:- 通过市场数据构造:
CallPut:期权类型(枚举值,如Call或Put)。ReferenceDate:交易日或估值日。StrikePx:行权价格。SpotPx:即期价格。Volatility:波动率。ExpiryDate:到期日。DeliveryDate:交割日。DomesticRate:货币 2 的利率。ForeignRate:货币 1 的利率。BuySell:买卖方向(枚举值,如Buy或Sell)。OptionExpiryNature:期权类型(枚举值)。PricingMethod:定价模型(枚举值)。Calendar:节假日对象。DayCounter:计息规则(枚举值)。PremiumDate:期权费支付日期。NumSimulation:模拟次数(MC)。FaceAmount:本金。
- 通过波动率曲面构造:
CallPut:期权类型(枚举值)。ReferenceDate:交易日或估值日。StrikePx:行权价格。SpotPx:即期价格。FaceAmount:本金。ExpiryDate:到期日。DeliveryDate:交割日。PremiumDate:期权费支付日期。BuySell:买卖方向(枚举值)。OptionExpiryNature:期权类型(枚举值)。PricingMethod:定价模型(枚举值)。Calendar:节假日对象。DayCounter:计息规则(枚举值)。VolSurface:波动率曲面对象。NumSimulation:模拟次数(MC)。DomesticRate:Ccy2 的利率曲线对象。ForeignRate:Ccy1 的利率曲线对象。
- 通过波动率曲面构造(简化版):
- 类似第二种,但省略部分参数。
- 通过市场数据构造:
fmt:参数格式(默认VP),Excel专用参数。
- 返回:McpVanillaOption 对象。
使用函数
Excel: =McpPrice(obj, isAmount=True)
Python: Price(*args)
- 功能:计算期权费。
- 参数:
Obj:McpVanillaOption 对象,Python Api不需要这个参数。isAmount:是否计算量,默认值为True。*args:是一个字典,不需要Obj参数,其他参数同Excel的参数。
- 返回:期权费。
Excel: =VoPrice(obj, isAmount=True, pricingMethod=None)
- 功能:计算货币二的 pips 值。
- 参数:
obj:McpVanillaOption 对象。isAmount:是否计算量,默认值为True。pricingMethod:定价模型(默认BlackScholes)。
- 返回:货币二的 pips 值。
Excel: =McpDelta(obj, isCcy2=False, isAmount=True, pricingMethod=1, isClosedFormMethod=True)
Python: Delta(*args)
- 功能:计算期权的Delta值。
- 参数:
obj:McpVanillaOption对象。isCcy2:是否是货币二。True表示是货币二,False表示不是。isAmount:是否计算量,默认值为True。pricingMethod:定价方法,默认值为1。isClosedFormMethod:是否使用闭式方法计算Greeks值,默认值为True。如果为True,则无论选择哪种模型计算Premium,Greeks值都采用Black-Scholes模型计算;否则使用选定的模型计算
Greeks值。*args:是一个字典,不需要obj参数,其他参数同Excel的参数。
- 返回:Delta。
Excel: =McpForwardDelta(obj, isCcy2=False, isAmount=True, pricingMethod=1, isClosedFormMethod=True)
Python: ForwardDelta(isCCY2=False, isAmount=True, npricingMethod=1, isClosedFormMethod=True)
- 功能:计算期权的ForwardDelta值。
- 参数:
obj:McpVanillaOption对象,Python Api不需要这个参数。isCcy2:是否是货币二。True表示是货币二,False表示不是。isAmount:是否计算量,默认值为True。pricingMethod:定价方法,默认值为1。isClosedFormMethod:是否使用闭式方法计算Greeks值,默认值为True。如果为True,则无论选择哪种模型计算Premium,Greeks值都采用Black-Scholes模型计算;否则使用选定的模型计算Greeks值。
- 返回:ForwardDelta。
Excel: =McpVega(obj, isCcy2=False, isAmount=True, pricingMethod=1, isClosedFormMethod=True)
Python: Vega(*args)
- 功能:计算期权的Vega值。
- 参数:
obj:McpVanillaOption对象。isCcy2:是否是货币二。True表示是货币二,False表示不是。isAmount:是否计算量,默认值为True。pricingMethod:定价方法,默认值为1。isClosedFormMethod:是否使用闭式方法计算Greeks值,默认值为True。如果为True,则无论选择哪种模型计算Premium,Greeks值都采用Black-Scholes模型计算;否则使用选定的模型计算Greeks值。*args:是一个字典,不需要obj参数,其他参数同Excel的参数。
- 返回:Vega。
Excel: =McpGamma(obj, isCcy2=False, isAmount=True, pricingMethod=1, isClosedFormMethod=True)
Python: Gamma(*args)
- 功能:计算期权的Gamma值。
- 参数:
obj:McpVanillaOption对象。isCcy2:是否是货币二。True表示是货币二,False表示不是。isAmount:是否计算量,默认值为True。pricingMethod:定价方法,默认值为1。isClosedFormMethod:是否使用闭式方法计算Greeks值,默认值为True。如果为True,则无论选择哪种模型计算Premium,Greeks值都采用Black-Scholes模型计算;否则使用选定的模型计算Greeks值。*args:是一个字典,不需要obj参数,其他参数同Excel的参数。
- 返回:Gamma。
Excel: =McpTheta(obj, isCcy2=False, isAmount=True, pricingMethod=1, isClosedFormMethod=True)
Python: Theta(*args)
- 功能:计算期权的Theta值。
- 参数:
obj:McpVanillaOption对象。isCcy2:是否是货币二。True表示是货币二,False表示不是。isAmount:是否计算量,默认值为True。pricingMethod:定价方法,默认值为1。isClosedFormMethod:是否使用闭式方法计算Greeks值,默认值为True。如果为True,则无论选择哪种模型计算Premium,Greeks值都采用Black-Scholes模型计算;否则使用选定的模型计算Greeks值。*args:是一个字典,不需要obj参数,其他参数同Excel的参数。
- 返回:Theta。
Excel: =McpVanna(obj, isCcy2=False, isAmount=True, pricingMethod=1, isClosedFormMethod=True)
Python: Vanna(isCCY2=False, isAmount=True, npricingMethod=1, isClosedFormMethod=True)
- 功能:计算期权的Vanna值。
- 参数:
obj:McpVanillaOption对象,Python Api不需要这个参数。isCcy2:是否是货币二。True表示是货币二,False表示不是。isAmount:是否计算量,默认值为True。pricingMethod:定价方法,默认值为1。isClosedFormMethod:是否使用闭式方法计算Greeks值,默认值为True。如果为True,则无论选择哪种模型计算Premium,Greeks值都采用Black-Scholes模型计算;否则使用选定的模型计算Greeks值。
- 返回:Vanna。
Excel: =McpVolga(obj, isCcy2=False, isAmount=True, pricingMethod=1, isClosedFormMethod=True)
Python: Volga(isCCY2=False, isAmount=True, npricingMethod=1, isClosedFormMethod=True)
- 功能:计算期权的Volga值。
- 参数:
obj:McpVanillaOption对象,Python Api不需要这个参数。isCcy2:是否是货币二。True表示是货币二,False表示不是。isAmount:是否计算量,默认值为True。pricingMethod:定价方法,默认值为1。isClosedFormMethod:是否使用闭式方法计算Greeks值,默认值为True。如果为True,则无论选择哪种模型计算Premium,Greeks值都采用Black-Scholes模型计算;否则使用选定的模型计算Greeks值。
- 返回:Volga。
Excel: =McpRho(obj, isCcy2=False, isAmount=True, pricingMethod=1, isClosedFormMethod=True)
Python: Rho(*args)
- 功能:计算期权的Rho值。
- 参数:
obj:McpVanillaOption对象。isCcy2:是否是货币二。True表示是货币二,False表示不是。isAmount:是否计算量,默认值为True。pricingMethod:定价方法,默认值为1。isClosedFormMethod:是否使用闭式方法计算Greeks值,默认值为True。如果为True,则无论选择哪种模型计算Premium,Greeks值都采用Black-Scholes模型计算;否则使用选定的模型计算Greeks值。*args:是一个字典,不需要obj参数,其他参数同Excel的参数。
- 返回:Rho。
Excel: =McpMarketValue(obj, isAmount=True)
Python: MarketValue(isAmount=True)
- 功能:计算 MarketValue。
- 参数:
Obj:McpVanillaOption 对象,Python Api不需要这个参数。isAmount:是否计算量,(默认True)。
- 返回:MarketValue。
Excel: =McpPV(obj, isAmount=True)
Python: PV(isAmount=True)
- 功能:计算 PV。
- 参数:
Obj:McpVanillaOption 对象,Python Api不需要这个参数。isAmount:是否计算量,(默认True)。
- 返回:PV。
其他使用函数
Excel: =Forward2ImpliedBaseRate(pair, forward, spot, termRate, spotDate, deliveryDate)
- 功能:计算 CCY1 的隐含利率。
- 参数:
pair:货币对。forward:远期价格。spot:即期价格。termRate:CCY2 的利率。spotDate:起息日。deliveryDate:交割日。
- 返回:CCY1 的隐含利率。
Excel: =Forward2ImpliedTermRate(pair, forward, spot, baseRate, spotDate, deliveryDate)
- 功能:计算 CCY2 的隐含利率。
- 参数:
pair:货币对。forward:远期价格。spot:即期价格。baseRate:CCY1 的利率。spotDate:起息日。deliveryDate:交割日。
- 返回:CCY2 的隐含利率。
Excel: =ImpliedForward(pair, baseRate, termRate, spot, spotDate, deliveryDate)
- 功能:计算隐含远期价格。
- 参数:
pair:货币对。baseRate:CCY1 的利率。termRate:CCY2 的利率。spot:即期价格。spotDate:起息日。deliveryDate:交割日。
- 返回:隐含远期价格。
Excel: =ImpliedFwdPoints(pair, baseRate, termRate, spot, spotDate, deliveryDate)
- 功能:计算隐含隐含掉期点。
- 参数:
pair:货币对。baseRate:CCY1 的利率。termRate:CCY2 的利率。spot:即期价格。spotDate:起息日。deliveryDate:交割日。
- 返回:隐含掉期点。
注意事项
- 参数格式:
fmt参数用于指定参数格式,默认值为VP。 - 枚举值:部分参数(如
CallPut、BuySell)为枚举值,需参考具体定义。 - 默认值:未明确说明的参数通常有默认值,可根据需求调整。
