38 const ext::shared_ptr<CapFloorTermVolSurface>& termVolSurface,
39 const ext::shared_ptr<IborIndex>& index,
45 const Real displacement,
48 floatingSwitchStrike_(switchStrike ==
Null<
Rate>()), switchStrike_(switchStrike),
49 accuracy_(accuracy), maxIter_(maxIter), dontThrow_(dontThrow) {
56 Real firstGuess = 0.14;
65 ext::shared_ptr<BlackCapFloorEngine> dummy(
new
76 ext::shared_ptr<FloatingRateCoupon> lFRC =
87 Rate averageAtmOptionletRate = 0.0;
101 ext::shared_ptr<PricingEngine> capFloorEngine;
102 ext::shared_ptr<SimpleQuote> volQuote(
new SimpleQuote);
105 capFloorEngine = ext::make_shared<BlackCapFloorEngine>(
110 capFloorEngine = ext::make_shared<BachelierCapFloorEngine>(
125 Real previousCapFloorPrice = 0.0;
131 ext::shared_ptr<CapFloor> capFloor =
137 previousCapFloorPrice;
159 catch (std::exception &e) {
163 QL_FAIL(
"could not bootstrap optionlet:"
164 "\n type: " << optionletType <<
165 "\n strike: " <<
io::rate(strikes[j]) <<
168 "\n annuity: " << optionletAnnuity <<
170 "\n error: " << e.what());
Bachelier-Black-formula cap/floor engine.
Black-formula cap/floor engine.
Black-formula cap/floor engine.
Base class for cap-like instruments.
ext::shared_ptr< FloatingRateCoupon > lastFloatingRateCoupon() const
Time yearFraction(const Date &, const Date &, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date()) const
Returns the period between two dates as a fraction of year.
Shared handle to an observable.
virtual void calculate() const
MakeCapFloor & withPricingEngine(const ext::shared_ptr< PricingEngine > &engine)
Matrix used in linear algebra.
template class providing a null value for a given type.
const Matrix & capletVols() const
void performCalculations() const override
bool floatingSwitchStrike_
Rate switchStrike() const
const Matrix & optionletPrices() const
OptionletStripper1(const ext::shared_ptr< CapFloorTermVolSurface > &, const ext::shared_ptr< IborIndex > &index, Rate switchStrikes=Null< Rate >(), Real accuracy=1.0e-6, Natural maxIter=100, const Handle< YieldTermStructure > &discount={}, VolatilityType type=ShiftedLognormal, Real displacement=0.0, bool dontThrow=false)
const Matrix & capFloorPrices() const
const Matrix & capFloorVolatilities() const
std::vector< Rate > atmOptionletRate_
std::vector< std::vector< Volatility > > optionletVolatilities_
std::vector< Period > capFloorLengths_
Handle< YieldTermStructure > discount_
ext::shared_ptr< IborIndex > iborIndex_
std::vector< Date > optionletPaymentDates_
std::vector< Time > optionletAccrualPeriods_
std::vector< Time > optionletTimes_
std::vector< Date > optionletDates_
const VolatilityType volatilityType_
ext::shared_ptr< CapFloorTermVolSurface > termVolSurface_
market element returning a stored value
#define QL_FAIL(message)
throw an error (possibly with file and line information)
detail::percent_holder rate(Rate)
output rates and spreads as percentages
Real DiscountFactor
discount factor between dates
unsigned QL_INTEGER Natural
positive integer
std::size_t Size
size of a container
base class for Inter-Bank-Offered-Rate indexes
Helper class to instantiate standard market cap/floor.
Real blackFormulaImpliedStdDev(Option::Type optionType, Real strike, Real forward, Real blackPrice, Real discount, Real displacement, Real guess, Real accuracy, Natural maxIterations)
Real bachelierBlackFormulaImpliedVol(Option::Type optionType, Real strike, Real forward, Real tte, Real bachelierPrice, Real discount)
optionlet (caplet/floorlet) volatility stripper
Base class for pricing engines.