35 ext::shared_ptr<IborIndex> index,
38 bool includeFirstSwaplet,
44 index_(
std::move(index)), termStructure_(
std::move(termStructure)),
45 fixedLegFrequency_(fixedLegFrequency), fixedLegDayCounter_(
std::move(fixedLegDayCounter)),
46 includeFirstSwaplet_(includeFirstSwaplet) {
54 cap_->setupArguments(&args);
55 std::vector<Time> capTimes =
59 times.insert(times.end(),
60 capTimes.begin(), capTimes.end());
72 ext::shared_ptr<PricingEngine> engine;
75 engine = ext::make_shared<BlackCapFloorEngine>(
79 engine = ext::make_shared<BachelierCapFloorEngine>(
85 cap_->setPricingEngine(engine);
94 Rate fixedRate = 0.04;
95 Date startDate, maturity;
103 ext::shared_ptr<IborIndex> dummyIndex(
new
109 index_->businessDayConvention(),
114 std::vector<Real> nominals(1,1.0);
116 Schedule floatSchedule(startDate, maturity,
118 index_->businessDayConvention(),
119 index_->businessDayConvention(),
136 swap.setPricingEngine(ext::shared_ptr<PricingEngine>(
138 Rate fairRate = fixedRate -
swap.NPV()/(
swap.legBPS(1)/1.0e-4);
139 cap_ = ext::make_shared<Cap>(floatingLeg,
140 std::vector<Rate>(1, fairRate));
Bachelier-Black-formula cap/floor engine.
Black-formula cap/floor engine.
CapHelper calibration helper.
Cash flow vector builders.
Actual/365 (Fixed) day count convention.
liquid Black76 market instrument used during calibration
void performCalculations() const override
const VolatilityType volatilityType_
ext::shared_ptr< PricingEngine > engine_
Arguments for cap/floor calculation
void performCalculations() const override
CapHelper(const Period &length, const Handle< Quote > &volatility, ext::shared_ptr< IborIndex > index, Frequency fixedLegFrequency, DayCounter fixedLegDayCounter, bool includeFirstSwaplet, Handle< YieldTermStructure > termStructure, BlackCalibrationHelper::CalibrationErrorType errorType=BlackCalibrationHelper::RelativePriceError, VolatilityType type=ShiftedLognormal, Real shift=0.0)
const ext::shared_ptr< IborIndex > index_
Real blackPrice(Volatility volatility) const override
Black or Bachelier price given a volatility.
Real modelValue() const override
returns the price of the instrument according to the model
void addTimesTo(std::list< Time > ×) const override
const Frequency fixedLegFrequency_
ext::shared_ptr< Cap > cap_
const Handle< YieldTermStructure > termStructure_
const DayCounter fixedLegDayCounter_
const bool includeFirstSwaplet_
Discounting engine for swaps.
std::vector< Time > mandatoryTimes() const override
helper class building a sequence of fixed rate coupons
FixedRateLeg & withNotionals(Real)
FixedRateLeg & withPaymentAdjustment(BusinessDayConvention)
FixedRateLeg & withCouponRates(Rate, const DayCounter &paymentDayCounter, Compounding comp=Simple, Frequency freq=Annual)
Shared handle to an observable.
base class for Inter-Bank-Offered-Rate indexes (e.g. Libor, etc.)
helper class building a sequence of capped/floored ibor-rate coupons
IborLeg & withPaymentAdjustment(BusinessDayConvention)
IborLeg & withNotionals(Real notional)
IborLeg & withFixingDays(Natural fixingDays)
virtual void calculate() const
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
market element returning a stored value
#define QL_FAIL(message)
throw an error (possibly with file and line information)
Frequency
Frequency of events.
Real Volatility
volatility
void swap(Array &v, Array &w) noexcept
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.