和顺 / 衡律 返回所属 Agent
11.6

欧式期权解析定价

原能力

实现规定范围的欧式期权解析计算,核对分红、期限和参数有效域。(合同附件 R7 11.6)

首选项目

QuantLib(Modified BSD,上游许可正文)。 QuantLib

匹配范围

AnalyticEuropeanEngine 的欧式期权解析计算。

源码

QuantLib · AnalyticEuropeanEngine::calculate(

ql/pricingengines/vanilla/analyticeuropeanengine.cpp · 42–55 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
    void AnalyticEuropeanEngine::calculate() const {

        // if the discount curve is not specified, we default to the
        // risk free rate curve embedded within the GBM process
        ext::shared_ptr<YieldTermStructure> discountPtr = 
            discountCurve_.empty() ? 
            process_->riskFreeRate().currentLink() :
            discountCurve_.currentLink();

        QL_REQUIRE(arguments_.exercise->type() == Exercise::European,
                   "not an European option");

        ext::shared_ptr<StrikedTypePayoff> payoff =
            ext::dynamic_pointer_cast<StrikedTypePayoff>(arguments_.payoff);
  • Copyright (C) 2003 Ferdinando Ametrano
  • Copyright (C) 2007 StatPro Italia srl
接口用法示意
option.setPricingEngine(ql.AnalyticEuropeanEngine(process)); value = option.NPV()

实现与验收要点

模型、股息、期限、参数有效区间和独立数值验收。