27 class BlackKarasinski::Helper {
30 Real discountBondPrice,
31 const ext::shared_ptr<ShortRateTree>&
tree)
33 dt_(
tree->timeGrid().dt(i)),
35 statePrices_(
tree->statePrices(i)),
36 discountBondPrice_(discountBondPrice) {}
42 Real discount = std::exp(-std::exp(
theta+x)*dt_);
43 value -= statePrices_[j]*discount;
53 const Array& statePrices_;
54 Real discountBondPrice_;
61 a_(arguments_[0]),
sigma_(arguments_[1]) {
69 ext::shared_ptr<Lattice>
72 ext::shared_ptr<ShortRateDynamics> numericDynamics(
74 ext::shared_ptr<TrinomialTree> trinomial(
76 ext::shared_ptr<ShortRateTree> numericTree(
80 ext::shared_ptr<NumericalImpl> impl =
86 for (
Size i=0; i<(grid.
size() - 1); i++) {
88 Real xMin = trinomial->underlying(i, 0);
89 Real dx = trinomial->dx(i);
90 Helper finder(i, xMin, dx, discountBond, numericTree);
94 impl->set(grid[i],
value);
99 ext::shared_ptr<OneFactorModel::ShortRateDynamics>
103 ext::shared_ptr<Lattice> lattice = this->
tree(
105 ext::shared_ptr<ShortRateDynamics> numericDynamics(
107 return numericDynamics;
Short-rate dynamics in the Black-Karasinski model.
ext::shared_ptr< Lattice > tree(const TimeGrid &grid) const override
Return by default a trinomial recombining tree.
BlackKarasinski(const Handle< YieldTermStructure > &termStructure, Real a=0.1, Real sigma=0.1)
ext::shared_ptr< ShortRateDynamics > dynamics() const override
returns the short-rate dynamics
Real value(const Array ¶ms, const std::vector< ext::shared_ptr< CalibrationHelper > > &)
Standard constant parameter .
Shared handle to an observable.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
Recombining trinomial tree discretizing the state variable.
Single-factor short-rate model abstract class.
const ext::shared_ptr< Impl > & implementation() const
Constraint imposing positivity to all arguments
void setMaxEvaluations(Size evaluations)
Real solve(const F &f, Real accuracy, Real guess, Real step) const
Term-structure consistent model class.
const Handle< YieldTermStructure > & termStructure() const
Deterministic time-dependent parameter used for yield-curve fitting.
Recombining trinomial tree class.
Real Time
continuous quantity with 1-year units
std::size_t Size
size of a container