Ejemplo n.º 1
0
    BlackKarasinski::BlackKarasinski(
                              const Handle<YieldTermStructure>& termStructure,
                              Real a, Real sigma)
    : OneFactorModel(2), TermStructureConsistentModel(termStructure),
      a_(arguments_[0]), sigma_(arguments_[1]) {
        a_ = ConstantParameter(a, PositiveConstraint());
        sigma_ = ConstantParameter(sigma, PositiveConstraint());

        registerWith(termStructure);
    }
Ejemplo n.º 2
0
 LmLinearExponentialVolatilityModel::LmLinearExponentialVolatilityModel(
                                      const std::vector<Time>& fixingTimes,
                                      Real a, Real b, Real c, Real d)
 : LmVolatilityModel(fixingTimes.size(), 4),
   fixingTimes_(fixingTimes) {
     arguments_[0] = ConstantParameter(a, PositiveConstraint());
     arguments_[1] = ConstantParameter(b, PositiveConstraint());
     arguments_[2] = ConstantParameter(c, PositiveConstraint());
     arguments_[3] = ConstantParameter(d, PositiveConstraint());
 }
Ejemplo n.º 3
0
    BatesDetJumpModel::BatesDetJumpModel(
            const boost::shared_ptr<BatesProcess> & process,
            Real kappaLambda, Real thetaLambda)
    : BatesModel(process) {
        arguments_.resize(10);

        arguments_[8] =
            ConstantParameter(kappaLambda, PositiveConstraint());
        arguments_[9] =
            ConstantParameter(thetaLambda, PositiveConstraint());
    }
Ejemplo n.º 4
0
    BatesDoubleExpDetJumpModel::BatesDoubleExpDetJumpModel(
        const boost::shared_ptr<HestonProcess> & process,
        Real lambda, Real nuUp, Real nuDown,
        Real p, Real kappaLambda, Real thetaLambda)
    : BatesDoubleExpModel(process, lambda, nuUp, nuDown, p) {
        arguments_.resize(11);

        arguments_[9]  =
            ConstantParameter(kappaLambda, PositiveConstraint());
        arguments_[10] =
            ConstantParameter(thetaLambda, PositiveConstraint());
    }
Ejemplo n.º 5
0
    BatesDoubleExpModel::BatesDoubleExpModel(
        const boost::shared_ptr<HestonProcess> & process,
        Real lambda, Real nuUp, Real nuDown, Real p)
    : HestonModel(process) {
        arguments_.resize(9);

        arguments_[5] = ConstantParameter(p,
                                          BoundaryConstraint(0.0, 1.0));
        arguments_[6] = ConstantParameter(nuDown, PositiveConstraint());
        arguments_[7] = ConstantParameter(nuUp,   PositiveConstraint());
        arguments_[8] = ConstantParameter(lambda, PositiveConstraint());
    }
Ejemplo n.º 6
0
    BatesModel::BatesModel(const boost::shared_ptr<BatesProcess> & process)
    : HestonModel(process) {
        arguments_.resize(8);

        arguments_[5] 
                = ConstantParameter(process->nu(),     NoConstraint());
        arguments_[6] 
                = ConstantParameter(process->delta(),  PositiveConstraint());
        arguments_[7] 
                = ConstantParameter(process->lambda(), PositiveConstraint());
        
        generateArguments();
    }
Ejemplo n.º 7
0
	Generalized_HullWhite::Generalized_HullWhite(const Handle<YieldTermStructure>& termStructure,
		std::vector<Date> dates,
		std::vector<Real> sigma,
		Real a,
		Real fxVol,
		Real fxCorr)
		: Vasicek(termStructure->forwardRate(0.0, 0.0, Continuous, NoFrequency), a, 0.0, sigma[0], 0.0), a0_(a),
		TermStructureConsistentModel(termStructure), fxVol_(fxVol), fxCorr_(fxCorr)
	{
		a_ = NullParameter();
		b_ = NullParameter();
		lambda_ = NullParameter();

		DayCounter dc = termStructure->dayCounter();

		//volperiods_.push_back(0.0);
		for (Size i=0; i<dates.size()-1; i++)
			volperiods_.push_back(dc.yearFraction(Settings::instance().evaluationDate(), dates[i]));
		sigma_ = PiecewiseConstantParameter(volperiods_, PositiveConstraint());

		for (Size i=0; i< sigma_.size(); i++)
			sigma_.setParam(i, sigma[i]);


		generateArguments();
		registerWith(termStructure);
	}
    PiecewiseTimeDependentHestonModel::PiecewiseTimeDependentHestonModel(
        const Handle<YieldTermStructure>& riskFreeRate,
        const Handle<YieldTermStructure>& dividendYield,
        const Handle<Quote>& s0,
        Real v0,
        const Parameter& theta,
        const Parameter& kappa,
        const Parameter& sigma,
        const Parameter& rho,
        const TimeGrid& timeGrid)
    : CalibratedModel(5), 
      s0_           (s0),
      riskFreeRate_ (riskFreeRate),
      dividendYield_(dividendYield),
      timeGrid_     (timeGrid) {
            
        arguments_[0] = theta;
        arguments_[1] = kappa;
        arguments_[2] = sigma;
        arguments_[3] = rho;
        arguments_[4] = ConstantParameter(v0, PositiveConstraint());

        registerWith(s0);
        registerWith(riskFreeRate);
        registerWith(dividendYield);
    }
Ejemplo n.º 9
0
    LmExtLinearExponentialVolModel::LmExtLinearExponentialVolModel(
                                         const std::vector<Time>& fixingTimes,
                                         Real a, Real b, Real c, Real d)
    : LmLinearExponentialVolatilityModel(fixingTimes, a, b, c, d) {

        arguments_.resize(4+size_);
        for (Size i=0; i <size_; ++i) {
            arguments_[i+4] = ConstantParameter(1.0, PositiveConstraint());
        }
    }
Ejemplo n.º 10
0
	GeneralizedHullWhite::GeneralizedHullWhite(
        const Handle<YieldTermStructure>& yieldtermStructure,
		const std::vector<Date>& speedstructure,
		const std::vector<Date>& volstructure,
		const std::vector<Real>& speed,
		const std::vector<Real>& vol)
  : OneFactorModel(2), TermStructureConsistentModel(yieldtermStructure),
    speedstructure_(speedstructure),
    volstructure_(volstructure),
    a_(arguments_[0]), sigma_(arguments_[1]) {

        DayCounter dc = yieldtermStructure->dayCounter();

        speedperiods_.push_back(0.0);
        for (Size i=0;i<speedstructure.size()-1;i++)
            speedperiods_.push_back(dc.yearFraction(speedstructure[0],
                                                    speedstructure[i+1]));

        a_ = PiecewiseConstantParameter(speedperiods_, PositiveConstraint());

        volperiods_.push_back(0.0);
        for (Size i=0;i<volstructure.size()-1;i++)
            volperiods_.push_back(dc.yearFraction(volstructure[0],
                                                  volstructure[i+1]));

        sigma_ = PiecewiseConstantParameter(volperiods_, PositiveConstraint());

        a_.setParam(0,speed[0]);
        sigma_.setParam(0,vol[0]);

        for (Size i=1; i< sigma_.size();i++) {
            sigma_.setParam(i,vol[i-1]);
        }
        for (Size i=1; i< a_.size();i++) {
            a_.setParam(i,speed[i-1]);
        }

        registerWith(yieldtermStructure);
	}