コード例 #1
0
 public MakeMCHestonHullWhiteEngine(HybridHestonHullWhiteProcess process)
 {
     process_        = process;
     steps_          = null;
     stepsPerYear_   = null;
     samples_        = null;
     maxSamples_     = null;
     antithetic_     = false;
     controlVariate_ = false;
     tolerance_      = null;
     seed_           = 0;
 }
コード例 #2
0
        protected override IPathGenerator <IRNG> controlPathGenerator()
        {
            int      dimensions = process_.factors();
            TimeGrid grid       = this.timeGrid();
            IRNG     generator  = (IRNG) new  RNG().make_sequence_generator(dimensions * (grid.size() - 1), this.seed_);
            HybridHestonHullWhiteProcess process = process_ as HybridHestonHullWhiteProcess;

            Utils.QL_REQUIRE(process != null, () => "invalid process");
            HybridHestonHullWhiteProcess cvProcess = new HybridHestonHullWhiteProcess(process.hestonProcess(),
                                                                                      process.hullWhiteProcess(), 0.0, process.discretization());

            return(new MultiPathGenerator <IRNG>(cvProcess, grid, generator, false));
        }
コード例 #3
0
 public MCHestonHullWhiteEngine(HybridHestonHullWhiteProcess process,
                                int?timeSteps,
                                int?timeStepsPerYear,
                                bool antitheticVariate,
                                bool controlVariate,
                                int?requiredSamples,
                                double?requiredTolerance,
                                int?maxSamples,
                                ulong seed)
     : base(process, timeSteps, timeStepsPerYear, false, antitheticVariate, controlVariate, requiredSamples,
            requiredTolerance, maxSamples, seed)
 {
     process_ = process;
 }
コード例 #4
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));
        }
コード例 #5
0
        protected override PathPricer <IPath> controlPathPricer()
        {
            HybridHestonHullWhiteProcess process = process_ as HybridHestonHullWhiteProcess;

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

            HestonProcess hestonProcess = process.hestonProcess();

            Utils.QL_REQUIRE(hestonProcess != null, () =>
                             "first constituent of the joint stochastic process need to be of type HestonProcess");

            Exercise exercise = this.arguments_.exercise;

            Utils.QL_REQUIRE(exercise.type() == Exercise.Type.European, () => "only european exercise is supported");

            double exerciseTime = process.time(exercise.lastDate());

            return(new HestonHullWhitePathPricer(exerciseTime, this.arguments_.payoff, process));
        }
コード例 #6
0
 public HestonHullWhitePathPricer(double exerciseTime, Payoff payoff, HybridHestonHullWhiteProcess process)
 {
     exerciseTime_ = exerciseTime;
     payoff_       = payoff;
     process_      = process;
 }