和顺 / 衡律 返回所属 Agent
11.11

风险敏感性、情景损益与误差分析

原能力

按同情景重估计算敏感性和损益,分别报告数值误差与模型限制。(合同附件 R7 11.11)

首选项目

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

匹配范围

Greeks、曲线风险和情景价格输出。

源码

QuantLib · class BlackCalculator

ql/pricingengines/blackcalculator.hpp · 33–46 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
    class BlackCalculator {
      private:
        class Calculator;
      public:
        BlackCalculator(const ext::shared_ptr<StrikedTypePayoff>& payoff,
                        Real forward,
                        Real stdDev,
                        Real discount = 1.0);
        BlackCalculator(Option::Type optionType,
                        Real strike,
                        Real forward,
                        Real stdDev,
                        Real discount = 1.0);
        virtual ~BlackCalculator() = default;
  • Copyright (C) 2003, 2004, 2005, 2006 Ferdinando Ametrano
  • Copyright (C) 2006 StatPro Italia srl

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

实现与验收要点

原扰动、风险单位、损益归属和误差分离。