22#include <ql/indexes/iborindex.hpp>
23#include <ql/models/shortrate/calibrationhelpers/swaptionhelper.hpp>
24#include <ql/pricingengines/swap/discountingswapengine.hpp>
25#include <ql/pricingengines/swaption/blackswaptionengine.hpp>
26#include <ql/pricingengines/swaption/discretizedswaption.hpp>
27#include <ql/quotes/simplequote.hpp>
28#include <ql/time/schedule.hpp>
36 ext::shared_ptr<IborIndex> index,
37 const Period& fixedLegTenor,
47 endDate_(
Null<
Date>()), maturity_(maturity), length_(length), fixedLegTenor_(fixedLegTenor),
48 index_(
std::move(index)), termStructure_(
std::move(termStructure)),
49 fixedLegDayCounter_(
std::move(fixedLegDayCounter)),
50 floatingLegDayCounter_(
std::move(floatingLegDayCounter)), strike_(strike), nominal_(nominal) {
58 ext::shared_ptr<IborIndex> index,
59 const Period& fixedLegTenor,
69 endDate_(
Null<
Date>()), maturity_(0 *
Days), length_(length), fixedLegTenor_(fixedLegTenor),
70 index_(
std::move(index)), termStructure_(
std::move(termStructure)),
71 fixedLegDayCounter_(
std::move(fixedLegDayCounter)),
72 floatingLegDayCounter_(
std::move(floatingLegDayCounter)), strike_(strike), nominal_(nominal) {
80 ext::shared_ptr<IborIndex> index,
81 const Period& fixedLegTenor,
91 endDate_(endDate), maturity_(0 *
Days), length_(0 *
Days), fixedLegTenor_(fixedLegTenor),
92 index_(
std::move(index)), termStructure_(
std::move(termStructure)),
93 fixedLegDayCounter_(
std::move(fixedLegDayCounter)),
94 floatingLegDayCounter_(
std::move(floatingLegDayCounter)), strike_(strike), nominal_(nominal) {
104 std::vector<Time> swaptionTimes =
108 times.insert(times.end(),
109 swaptionTimes.begin(), swaptionTimes.end());
121 ext::shared_ptr<PricingEngine> engine;
124 engine = ext::make_shared<BlackSwaptionEngine>(
128 engine = ext::make_shared<BachelierSwaptionEngine>(
149 index_->businessDayConvention());
151 Date startDate =
index_->valueDate(
index_->fixingCalendar().adjust(exerciseDate));
156 index_->businessDayConvention());
159 index_->businessDayConvention(),
160 index_->businessDayConvention(),
162 Schedule floatSchedule(startDate, endDate,
index_->tenor(), calendar,
163 index_->businessDayConvention(),
164 index_->businessDayConvention(),
167 ext::shared_ptr<PricingEngine> swapEngine(
185 swap_ = ext::make_shared<VanillaSwap>(
189 swap_->setPricingEngine(swapEngine);
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_
Date advance(const Date &, Integer n, TimeUnit unit, BusinessDayConvention convention=Following, bool endOfMonth=false) const
std::vector< Time > mandatoryTimes() const override
Shared handle to an observable.
void setPricingEngine(const ext::shared_ptr< PricingEngine > &)
set the pricing engine to be used.
virtual void calculate() const
template class providing a null value for a given type.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
market element returning a stored value
Arguments for swaption calculation
ext::shared_ptr< Swaption > swaption_
void performCalculations() const override
ext::shared_ptr< VanillaSwap > swap_
const ext::shared_ptr< IborIndex > index_
Real blackPrice(Volatility volatility) const override
Black or Bachelier price given a volatility.
const Period fixedLegTenor_
Real modelValue() const override
returns the price of the instrument according to the model
SwaptionHelper(const Period &maturity, const Period &length, const Handle< Quote > &volatility, ext::shared_ptr< IborIndex > index, const Period &fixedLegTenor, DayCounter fixedLegDayCounter, DayCounter floatingLegDayCounter, Handle< YieldTermStructure > termStructure, BlackCalibrationHelper::CalibrationErrorType errorType=BlackCalibrationHelper::RelativePriceError, Real strike=Null< Real >(), Real nominal=1.0, VolatilityType type=ShiftedLognormal, Real shift=0.0)
void addTimesTo(std::list< Time > ×) const override
const DayCounter floatingLegDayCounter_
const Handle< YieldTermStructure > termStructure_
const DayCounter fixedLegDayCounter_
Plain-vanilla swap: fix vs ibor leg.
Real Volatility
volatility