Exemple #1
0
        public HybridHestonHullWhiteProcess(HestonProcess hestonProcess,
                                            HullWhiteForwardProcess hullWhiteProcess,
                                            double corrEquityShortRate,
                                            Discretization discretization = Discretization.BSMHullWhite)
        {
            hestonProcess_    = hestonProcess;
            hullWhiteProcess_ = hullWhiteProcess;
            hullWhiteModel_   = new HullWhite(hestonProcess.riskFreeRate(),
                                              hullWhiteProcess.a(),
                                              hullWhiteProcess.sigma());
            corrEquityShortRate_ = corrEquityShortRate;
            disc_   = discretization;
            maxRho_ = Math.Sqrt(1 - hestonProcess.rho() * hestonProcess.rho())
                      - Math.Sqrt(Const.QL_EPSILON) /* reserve for rounding errors */;

            T_           = hullWhiteProcess.getForwardMeasureTime();
            endDiscount_ = hestonProcess.riskFreeRate().link.discount(T_);

            Utils.QL_REQUIRE(corrEquityShortRate * corrEquityShortRate
                             + hestonProcess.rho() * hestonProcess.rho() <= 1.0, () =>
                             "correlation matrix is not positive definite");

            Utils.QL_REQUIRE(hullWhiteProcess.sigma() > 0.0, () =>
                             "positive vol of Hull White process is required");
        }
 public AnalyticH1HWEngine(HestonModel model, HullWhite hullWhiteModel, double rhoSr, int integrationOrder = 144)
     : base(model, hullWhiteModel, integrationOrder)
 {
     rhoSr_ = rhoSr;
     Utils.QL_REQUIRE(rhoSr_ >= 0.0, () => "Fourier integration is not stable if " +
                      "the equity interest rate correlation is negative");
 }
        public AnalyticHestonHullWhiteEngine(HestonModel hestonModel,
                                             HullWhite hullWhiteModel,
                                             double relTolerance, int maxEvaluations)
            : base(hestonModel, relTolerance, maxEvaluations)
        {
            hullWhiteModel_ = hullWhiteModel;

            update();
            hullWhiteModel_.registerWith(update);
        }
        // see AnalticHestonEninge for usage of different constructors
        public AnalyticHestonHullWhiteEngine(HestonModel hestonModel,
                                             HullWhite hullWhiteModel,
                                             int integrationOrder = 144)
            : base(hestonModel, integrationOrder)
        {
            hullWhiteModel_ = hullWhiteModel;

            update();
            hullWhiteModel_.registerWith(update);
        }
Exemple #5
0
 public FdmHullWhiteOp(FdmMesher mesher,
                       HullWhite model,
                       int direction)
 {
     x_     = mesher.locations(direction);
     dzMap_ = new TripleBandLinearOp(new FirstDerivativeOp(direction, mesher).mult(-1.0 * x_ * model.a()).add(
                                         new SecondDerivativeOp(direction, mesher).mult(0.5 * model.sigma() * model.sigma()
                                                                                        * new Vector(mesher.layout().size(), 1.0))));
     mapT_      = new TripleBandLinearOp(direction, mesher);
     direction_ = direction;
     model_     = model;
 }
 public Fj_Helper(Handle <HestonModel> hestonModel, HullWhite hullWhiteModel, double rhoSr, double term,
                  double strike, int j)
 {
     j_      = j;
     lambda_ = hullWhiteModel.a();
     eta_    = hullWhiteModel.sigma();
     v0_     = hestonModel.link.v0();
     kappa_  = hestonModel.link.kappa();
     theta_  = hestonModel.link.theta();
     gamma_  = hestonModel.link.sigma();
     d_      = 4.0 * kappa_ * theta_ / (gamma_ * gamma_);
     rhoSr_  = rhoSr;
     term_   = term;
 }
Exemple #7
0
        protected override IPricingEngine controlPricingEngine()
        {
            HybridHestonHullWhiteProcess process = process_ as HybridHestonHullWhiteProcess;

            Utils.QL_REQUIRE(process != null, () => "invalid process");

            HestonProcess hestonProcess = process.hestonProcess();

            HullWhiteForwardProcess hullWhiteProcess = process.hullWhiteProcess();

            HestonModel hestonModel = new HestonModel(hestonProcess);

            HullWhite hwModel = new HullWhite(hestonProcess.riskFreeRate(),
                                              hullWhiteProcess.a(),
                                              hullWhiteProcess.sigma());

            return(new AnalyticHestonHullWhiteEngine(hestonModel, hwModel, 144));
        }
 public AnalyticH1HWEngine(HestonModel model, HullWhite hullWhiteModel, double rhoSr, double relTolerance,
                           int maxEvaluations)
     : base(model, hullWhiteModel, relTolerance, maxEvaluations)
 {
     rhoSr_ = rhoSr;
 }