当前位置: 首页>>代码示例>>Java>>正文


Java BlackScholesMertonModel类代码示例

本文整理汇总了Java中com.opengamma.analytics.financial.model.option.pricing.analytic.BlackScholesMertonModel的典型用法代码示例。如果您正苦于以下问题:Java BlackScholesMertonModel类的具体用法?Java BlackScholesMertonModel怎么用?Java BlackScholesMertonModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BlackScholesMertonModel类属于com.opengamma.analytics.financial.model.option.pricing.analytic包,在下文中一共展示了BlackScholesMertonModel类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculate

import com.opengamma.analytics.financial.model.option.pricing.analytic.BlackScholesMertonModel; //导入依赖的package包/类
@Override
public void calculate() {

    if (contractPrice == null && impliedVolatility == null) {
        throw new IllegalArgumentException("To find contract price, implied volatility must be known in advance.  To find IV, contract price must be known in advance.  Both are null.");
    }

    BlackScholesMertonModel model = new BlackScholesMertonModel();

    if (contractPrice == null) {
        // @param forward The forward value of the underlying  -> getStrike
        // @param strike The Strike    -> getStrike
        // @param timeToExpiry The time-to-expiry -> getTimeToExpiry
        // @param lognormalVol The log-normal volatility -> impliedVolatility
        // @param isCall True for calls, false for puts  -> isCall()
        contractPrice = BlackFormulaRepository.price(strike, strike, getTimeToExpiry(), impliedVolatility, isCall());
    } else if (impliedVolatility == null) {
        // @param price The <b>forward</b> price -> contractPrice
        // @param forward The forward value of the underlying -> strike
        // @param strike The Strike -> getStrike()
        // @param timeToExpiry The time-to-expiry -> getTimeToExpiry()
        // @param isCall true for call -> isCall()
        impliedVolatility = BlackFormulaRepository.impliedVolatility(contractPrice, getStrike(), getStrike(), getTimeToExpiry(), isCall());
    }

    calculateGreeks();
}
 
开发者ID:anonymoose,项目名称:clj-options,代码行数:28,代码来源:EuropeanEquityOption.java


注:本文中的com.opengamma.analytics.financial.model.option.pricing.analytic.BlackScholesMertonModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。