Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
TsiveriotisFernandesLattice< T > Class Template Reference

Binomial lattice approximating the Tsiveriotis-Fernandes model. More...

#include <qle/pricingengines/tflattice.hpp>

+ Inheritance diagram for TsiveriotisFernandesLattice< T >:
+ Collaboration diagram for TsiveriotisFernandesLattice< T >:

Public Member Functions

 TsiveriotisFernandesLattice (const ext::shared_ptr< T > &tree, Rate riskFreeRate, Time end, Size steps, Spread creditSpread, Volatility volatility, Spread divYield)
 
Spread creditSpread () const
 

Protected Member Functions

void stepback (Size i, const Array &values, const Array &conversionProbability, const Array &spreadAdjustedRate, Array &newValues, Array &newConversionProbability, Array &newSpreadAdjustedRate) const
 
void rollback (DiscretizedAsset &, Time to) const override
 
void partialRollback (DiscretizedAsset &, Time to) const override
 

Private Attributes

Spread creditSpread_
 

Detailed Description

template<class T>
class QuantExt::TsiveriotisFernandesLattice< T >

Binomial lattice approximating the Tsiveriotis-Fernandes model.

Definition at line 34 of file tflattice.hpp.

Constructor & Destructor Documentation

◆ TsiveriotisFernandesLattice()

TsiveriotisFernandesLattice ( const ext::shared_ptr< T > &  tree,
Rate  riskFreeRate,
Time  end,
Size  steps,
Spread  creditSpread,
Volatility  volatility,
Spread  divYield 
)

Definition at line 54 of file tflattice.hpp.

57 : BlackScholesLattice<T>(tree, riskFreeRate, end, steps), creditSpread_(creditSpread) {
58 QL_REQUIRE(this->pu_ <= 1.0, "probability (" << this->pu_ << ") higher than one");
59 QL_REQUIRE(this->pu_ >= 0.0, "negative (" << this->pu_ << ") probability");
60}
std::vector< Size > steps

Member Function Documentation

◆ creditSpread()

Spread creditSpread ( ) const

Definition at line 39 of file tflattice.hpp.

39{ return creditSpread_; };

◆ stepback()

void stepback ( Size  i,
const Array &  values,
const Array &  conversionProbability,
const Array &  spreadAdjustedRate,
Array &  newValues,
Array &  newConversionProbability,
Array &  newSpreadAdjustedRate 
) const
protected

Definition at line 63 of file tflattice.hpp.

65 {
66
67 for (Size j = 0; j < this->size(i); j++) {
68
69 // new conversion probability is calculated via backward
70 // induction using up and down probabilities on tree on
71 // previous conversion probabilities, ie weighted average
72 // of previous probabilities.
73 newConversionProbability[j] = this->pd_ * conversionProbability[j] + this->pu_ * conversionProbability[j + 1];
74
75 // Use blended discounting rate
76 newSpreadAdjustedRate[j] = newConversionProbability[j] * this->riskFreeRate_ +
77 (1 - newConversionProbability[j]) * (this->riskFreeRate_ + creditSpread_);
78
79 newValues[j] = (this->pd_ * values[j] / (1 + (spreadAdjustedRate[j] * this->dt_))) +
80 (this->pu_ * values[j + 1] / (1 + (spreadAdjustedRate[j + 1] * this->dt_)));
81 }
82}

◆ rollback()

void rollback ( DiscretizedAsset asset,
Time  to 
) const
overrideprotected

Definition at line 84 of file tflattice.hpp.

84 {
85 partialRollback(asset, to);
86 asset.adjustValues();
87}
void partialRollback(DiscretizedAsset &, Time to) const override
Definition: tflattice.hpp:89

◆ partialRollback()

void partialRollback ( DiscretizedAsset asset,
Time  to 
) const
overrideprotected

Definition at line 89 of file tflattice.hpp.

89 {
90
91 Time from = asset.time();
92
93 if (close(from, to))
94 return;
95
96 QL_REQUIRE(from > to, "cannot roll the asset back to" << to << " (it is already at t = " << from << ")");
97
98 QuantExt::DiscretizedConvertible& convertible = dynamic_cast<QuantExt::DiscretizedConvertible&>(asset);
99
100 Integer iFrom = Integer(this->t_.index(from));
101 Integer iTo = Integer(this->t_.index(to));
102
103 for (Integer i = iFrom - 1; i >= iTo; --i) {
104
105 Array newValues(this->size(i));
106 Array newSpreadAdjustedRate(this->size(i));
107 Array newConversionProbability(this->size(i));
108
109 stepback(i, convertible.values(), convertible.conversionProbability(), convertible.spreadAdjustedRate(),
110 newValues, newConversionProbability, newSpreadAdjustedRate);
111
112 convertible.time() = this->t_[i];
113 convertible.values() = newValues;
114 convertible.spreadAdjustedRate() = newSpreadAdjustedRate;
115 convertible.conversionProbability() = newConversionProbability;
116
117 // skip the very last adjustment
118 if (i != iTo)
119 convertible.adjustValues();
120 }
121}
void stepback(Size i, const Array &values, const Array &conversionProbability, const Array &spreadAdjustedRate, Array &newValues, Array &newConversionProbability, Array &newSpreadAdjustedRate) const
Definition: tflattice.hpp:63
+ Here is the call graph for this function:

Member Data Documentation

◆ creditSpread_

Spread creditSpread_
private

Definition at line 48 of file tflattice.hpp.