25#ifndef quantlib_two_factor_model_hpp
26#define quantlib_two_factor_model_hpp
33 class StochasticProcess1D;
34 class StochasticProcess;
45 virtual ext::shared_ptr<ShortRateDynamics>
dynamics()
const = 0;
48 ext::shared_ptr<Lattice>
tree(
const TimeGrid& grid)
const override;
75 ext::shared_ptr<StochasticProcess1D>
yProcess,
84 const ext::shared_ptr<StochasticProcess1D>&
xProcess()
const {
89 const ext::shared_ptr<StochasticProcess1D>&
yProcess()
const {
99 ext::shared_ptr<StochasticProcess>
process()
const;
108 :
public TreeLattice2D<TwoFactorModel::ShortRateTree,TrinomialTree> {
112 const ext::shared_ptr<TrinomialTree>& tree2,
113 const ext::shared_ptr<ShortRateDynamics>&
dynamics);
117 Size index1 = index % modulo;
118 Size index2 = index / modulo;
const TimeGrid & timeGrid() const
Abstract short-rate model class.
Two-dimensional tree-based lattice.
ext::shared_ptr< TrinomialTree > tree1_
ext::shared_ptr< TrinomialTree > tree2_
Class describing the dynamics of the two state variables.
const ext::shared_ptr< StochasticProcess1D > & xProcess() const
Risk-neutral dynamics of the first state variable x.
ShortRateDynamics(ext::shared_ptr< StochasticProcess1D > xProcess, ext::shared_ptr< StochasticProcess1D > yProcess, Real correlation)
virtual Rate shortRate(Time t, Real x, Real y) const =0
ext::shared_ptr< StochasticProcess > process() const
Joint process of the two variables.
Real correlation() const
Correlation between the two brownian motions.
ext::shared_ptr< StochasticProcess1D > yProcess_
ext::shared_ptr< StochasticProcess1D > xProcess_
const ext::shared_ptr< StochasticProcess1D > & yProcess() const
Risk-neutral dynamics of the second state variable y.
virtual ~ShortRateDynamics()=default
Recombining two-dimensional tree discretizing the state variable.
ext::shared_ptr< ShortRateDynamics > dynamics_
DiscountFactor discount(Size i, Size index) const
Abstract base-class for two-factor models.
ext::shared_ptr< Lattice > tree(const TimeGrid &grid) const override
Returns a two-dimensional trinomial tree.
virtual ext::shared_ptr< ShortRateDynamics > dynamics() const =0
Returns the short-rate dynamics.
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
std::size_t Size
size of a container
Two-dimensional lattice class.
Abstract interest rate model class.
ext::shared_ptr< YieldTermStructure > r