跳到正文
QMT

ContextInfo.bsm_price

基于Black-Scholes-Merton模型,输入期权标的价格、期权行权价、无风险利率、期权标的年化波动率、剩余天数、标的分红率、计算期权的理论价格

原型

ContextInfo.bsm_price(optionType,objectPrices,strikePrice,riskFree,sigma,days,dividend)

释义

基于Black-Scholes-Merton模型,输入期权标的价格、期权行权价、无风险利率、期权标的年化波动率、剩余天数、标的分红率、计算期权的理论价格

参数

字段 类型 说明
optionType str 期权类型,认购:'C',认沽:'P'
objectPrices float 期权标的价格,可以是价格列表或者单个价格
strikePrice float 期权行权价
riskFree float 无风险收益率
sigma float 标的波动率
days int 剩余天数
dividend float 分红率

返回值

提示

  • objectPrices为float时,返回float

  • objectPrices为list时,返回list

  • 计算结果最小值0.0001,结果保留4位小数,输入非法参数返回nan

示例

#encoding:gbk
import numpy as np


def init(ContextInfo):
  pass

def after_init(ContextInfo):
  object_prices=list(np.arange(3,4,0.01));
  #计算剩余15天的行权价3.5的认购期权,在无风险利率3%,分红率为0,标的年化波动率为23%时标的价格从3元到4元变动过程中期权理论价格序列
  prices=ContextInfo.bsm_price('C',object_prices,3.5,0.03,0.23,15,0)
  print(prices)
  #计算剩余15天的行权价3.5的认购期权,在无风险利率3%,分红率为0,标的年化波动率为23%时标的价格为3.51元的平值期权的理论价格
  price=ContextInfo.bsm_price('C',3.51,3.5,0.03,0.23,15,0)
  print(price)

返回值

# 计算剩余15天的行权价3.5的认购期权,在无风险利率3%,分红率为0,标的年化波动率为23%时标的价格从3元到4元变动过程中期权理论价格序列
[0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0001, 0.0002, 0.0002, 0.0002, 0.0003, 0.0004, 0.0005, 0.0006, 0.0007, 0.0008, 0.001, 0.0012, 0.0015, 0.0017, 0.0021, 0.0025, 0.0029, 0.0034, 0.004, 0.0046, 0.0054, 0.0062, 0.0072, 0.0082, 0.0094, 0.0108, 0.0122, 0.0138, 0.0156, 0.0176, 0.0197, 0.022, 0.0246, 0.0273, 0.0302, 0.0334, 0.0368, 0.0404, 0.0443, 0.0484, 0.0527, 0.0573, 0.0621, 0.0672, 0.0725, 0.0781, 0.0839, 0.0899, 0.0962, 0.1027, 0.1094, 0.1163, 0.1235, 0.1308, 0.1383, 0.146, 0.1539, 0.162, 0.1702, 0.1785, 0.1871, 0.1957, 0.2044, 0.2133, 0.2223, 0.2314, 0.2405, 0.2498, 0.2591, 0.2685, 0.278, 0.2875, 0.2971, 0.3067, 0.3164, 0.3261, 0.3359, 0.3456, 0.3554, 0.3653, 0.3751, 0.385, 0.3949, 0.4048, 0.4147, 0.4246, 0.4346, 0.4445, 0.4545, 0.4644, 0.4744, 0.4844, 0.4944]
# 计算剩余15天的行权价3.5的认购期权,在无风险利率3%,分红率为0,标的年化波动率为23%时标的价格为3.51元的平值期权的理论价格
0.0725

官方来源

QMT 官方文档:基于BS模型计算欧式期权理论价格。网页核对日期:2026-10-11。

本页目录