30 bool withFellerConstraint)
39 ext::shared_ptr<Dynamics> numericDynamics(
42 ext::shared_ptr<TrinomialTree> trinomial(
46 ext::shared_ptr<NumericalImpl> impl =
49 return ext::shared_ptr<Lattice>(
66 QL_REQUIRE(strike>0.0,
"strike must be positive");
73 return std::max<Real>(discountS - strike, 0.0);
75 return std::max<Real>(strike - discountS, 0.0);
76 default:
QL_FAIL(
"unsupported option type");
81 Real h = std::sqrt(
k()*
k() + 2.0*sigma2);
86 Real rho = 2.0*h/(sigma2*(std::exp(h*
t) - 1.0));
87 Real psi = (
k() + h)/sigma2;
100 Real call = discountS*chis(2.0*z*(
rho+psi+
b)) -
101 strike*discountT*chit(2.0*z*(
rho+psi));
105 return call - discountS + strike*discountT;
Chi-square (central and non-central) distributions.
Real value(const Array ¶ms, const std::vector< ext::shared_ptr< CalibrationHelper > > &)
Cox-Ingersoll-Ross model class.
Real B(Time t, Time T) const override
Real A(Time t, Time T) const override
Short-rate dynamics in the extended Cox-Ingersoll-Ross model.
Real discountBondOption(Option::Type type, Real strike, Time maturity, Time bondMaturity) const override
void generateArguments() override
ext::shared_ptr< Lattice > tree(const TimeGrid &grid) const override
Return by default a trinomial recombining tree.
ExtendedCoxIngersollRoss(const Handle< YieldTermStructure > &termStructure, Real theta=0.1, Real k=0.1, Real sigma=0.1, Real x0=0.05, bool withFellerConstraint=true)
Real A(Time t, Time T) const override
Shared handle to an observable.
Recombining trinomial tree discretizing the state variable.
const ext::shared_ptr< Impl > & implementation() const
Term-structure consistent model class.
const Handle< YieldTermStructure > & termStructure() const
Deterministic time-dependent parameter used for yield-curve fitting.
Recombining trinomial tree class.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
#define QL_FAIL(message)
throw an error (possibly with file and line information)
Extended Cox-Ingersoll-Ross model.
ext::function< Real(Real)> b
@ NoFrequency
null frequency
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates