28 const ext::shared_ptr<LiborForwardModelProcess> & process,
29 const ext::shared_ptr<LmVolatilityModel> & volaModel,
30 const ext::shared_ptr<LmCorrelationModel> & corrModel)
31 :
CalibratedModel(volaModel->params().size()+corrModel->params().size()),
33 accrualPeriod_(process->size()),
38 const Size k=volaModel->params().size();
39 std::copy(volaModel->params().begin(), volaModel->params().end(),
41 std::copy(corrModel->params().begin(), corrModel->params().end(),
44 for (
Size i=0; i < process->size(); ++i) {
46 - process->accrualStartTimes()[i];
61 swaptionVola = ext::shared_ptr<SwaptionVolatilityMatrix>();
66 Time bondMaturity)
const {
68 const std::vector<Time> & accrualStartTimes
70 const std::vector<Time> & accrualEndTimes
73 QL_REQUIRE( accrualStartTimes.front()<= maturity
74 && accrualStartTimes.back() >= maturity,
75 "capet maturity does not fit to the process");
77 const Size i = std::lower_bound(accrualStartTimes.begin(),
78 accrualStartTimes.end(),
79 maturity) - accrualStartTimes.begin();
82 && std::fabs(maturity - accrualStartTimes[i])
83 < 100*std::numeric_limits<Real>::epsilon()
84 && std::fabs(bondMaturity - accrualEndTimes[i])
85 < 100*std::numeric_limits<Real>::epsilon(),
86 "irregular fixings are not (yet) supported");
88 const Real tenor = accrualEndTimes[i] - accrualStartTimes[i];
90 const Real capRate = (1.0/strike - 1.0)/tenor;
92 ->integratedCovariance(i, i,
process_->fixingTimes()[i]);
94 process_->index()->forwardingTermStructure()->discount(bondMaturity);
98 capRate, forward, std::sqrt(var));
100 const Real npv = dis * tenor * black;
102 return npv / (1.0 + capRate*tenor);
147 ext::shared_ptr<SwaptionVolatilityMatrix>
153 const ext::shared_ptr<IborIndex> index =
process_->index();
157 Matrix volatilities(size, size);
159 std::vector<Date> exercises(
process_->fixingDates().begin() + 1,
160 process_->fixingDates().begin() + size+1);
162 std::vector<Period> lengths(size);
163 for (
Size i=0; i < size; ++i) {
164 lengths[i] = (i+1)*index->tenor();
168 for (
Size k=0; k < size; ++k) {
174 for (
Size j=i; j <= k+size; ++j) {
180 for (
Size l=1; l <= size; ++l) {
190 volatilities[k][l-1] =
195 return swaptionVola = ext::make_shared<SwaptionVolatilityMatrix>(
197 exercises, lengths, volatilities,
198 index->dayCounter());
204 return process_->index()->forwardingTermStructure()->discount(
t);
1-D array used in linear algebra.
Array params() const
Returns array of arguments on which calibration is done.
std::vector< Parameter > arguments_
virtual void setParams(const Array ¶ms)
proxy for a libor forward model covariance parameterization
Real discountBond(Time now, Time maturity, Array factors) const override
const ext::shared_ptr< LfmCovarianceProxy > covarProxy_
void setParams(const Array ¶ms) override
Rate S_0(Size alpha, Size beta) const
LiborForwardModel(const ext::shared_ptr< LiborForwardModelProcess > &process, const ext::shared_ptr< LmVolatilityModel > &volaModel, const ext::shared_ptr< LmCorrelationModel > &corrModel)
Array w_0(Size alpha, Size beta) const
std::vector< Time > accrualPeriod_
Real discountBondOption(Option::Type type, Real strike, Time maturity, Time bondMaturity) const override
DiscountFactor discount(Time t) const override
Implied discount curve.
virtual ext::shared_ptr< SwaptionVolatilityMatrix > getSwaptionVolatilityMatrix() const
const ext::shared_ptr< LiborForwardModelProcess > process_
ext::shared_ptr< SwaptionVolatilityMatrix > swaptionVola
Matrix used in linear algebra.
Calendar for reproducing theoretical calculations.
ext::function< Real(Real)> f_
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
ext::function< Real(Real)> b
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
Real Volatility
volatility
std::size_t Size
size of a container
libor forward model incl. exact cap pricing Rebonato formula to approximate swaption prices.
Real blackFormula(Option::Type optionType, Real strike, Real forward, Real stdDev, Real discount, Real displacement)
Calendar for reproducing theoretical calculations.