51 const ext::shared_ptr<SwaptionVolatilityStructure>& volatilityStructure) :
52 forwardValue_(forwardValue), expiryDate_(expiryDate), swapTenor_(swapTenor),
53 volatilityStructure_(volatilityStructure),
54 smile_(volatilityStructure_->smileSection(expiryDate_, swapTenor_)) {
57 close_enough(volatilityStructure->shift(expiryDate, swapTenor), 0.0)),
58 "VanillaOptionPricer: a normal or a zero-shift lognormal volatility is required");
63 Real deflator)
const {
82 meanReversion_(
std::move(meanReversion)) {
92 QL_REQUIRE(accrualPeriod != 0.0,
"null accrual period");
97 rateCurve_ = swapIndex->discountingTermStructure().empty() ? *(swapIndex->forwardingTermStructure()) : *(swapIndex->discountingTermStructure());
109 ext::shared_ptr<VanillaSwap>
swap = swapIndex->underlyingSwap(
fixingDate_);
113 static const Spread bp = 1.0e-4;
116 Size q = swapIndex->fixedLegTenor().frequency();
118 const DayCounter& dc = swapIndex->dayCounter();
122 Time swapFirstPaymentTime =
126 Real delta = (paymentTime-startTime) / (swapFirstPaymentTime-startTime);
144 QL_FAIL(
"unknown/illegal gFunction type");
173 Real cutoffNearZero = 1e-10;
176 Rate effectiveStrikeForMax = std::max(effectiveCap, cutoffNearZero);
206 Real cutoffNearZero = 1e-10;
209 Rate effectiveStrikeForMin = std::max(effectiveFloor, cutoffNearZero);
233 class VariableChange {
235 VariableChange(ext::function<
Real (
Real)>&
f,
241 for (
Size i = 1; i <
k_ ; ++i) {
244 newVar =
a_ + x* temp;
245 return f_(newVar) *
k_* temp;
255 explicit Spy(ext::function<
Real(
Real)>
f) :
f_(std::move(
f)) {}
277 :
HaganPricer(swaptionVol, modelOfYieldCurve, meanReversion),
278 lowerLimit_(lowerLimit), upperLimit_(upperLimit),
279 precision_(precision), hardUpperLimit_(hardUpperLimit) {}
294 Real upperBoundary = 2 * a;
296 upperBoundary *= 2.0;
299 upperBoundary = std::min(upperBoundary,
b);
303 gaussKronrodNonAdaptive(
precision_, 1000000, 1.0);
307 if (upperBoundary > 2 * a) {
309 ext::function<
Real(
Real)> temp = ext::cref(integrand);
310 VariableChange variableChange(temp, a, upperBoundary, k);
311 f = [&](
Real _x) {
return variableChange.value(_x); };
312 result = gaussKronrodNonAdaptive(
f, .0, 1.0);
315 f = ext::cref(integrand);
316 result = gaussKronrodNonAdaptive(
f, a, upperBoundary);
323 result = integrator(integrand, a,
b);
330 result = integrator(integrand, a,
b);
339 result = integrator(integrand, a,
b);
349 ext::shared_ptr<ConundrumIntegrand> integrand(
new
355 Real a,
b, integralValue;
371 Real dFdK = integrand->firstDerivativeOfF(strike);
373 (*vanillaOptionPricer_)(strike, optionType,
annuity_);
377 ((1 + dFdK) * swaptionPrice +
Integer(optionType) * integralValue);
392 + atmCapletPrice - atmFloorletPrice)
399 Real percDiff = 1000.;
405 percDiff = diff/integralValue;
406 integralValue += diff;
408 return integralValue;
443 ext::shared_ptr<VanillaOptionPricer> o,
444 const ext::shared_ptr<YieldTermStructure>&,
445 ext::shared_ptr<GFunction> gFunction,
452 : vanillaOptionPricer_(
std::move(o)), forwardValue_(forwardValue), annuity_(annuity),
453 fixingDate_(fixingDate), paymentDate_(paymentDate),
strike_(strike), optionType_(optionType),
454 gFunction_(
std::move(gFunction)) {}
473 const Real Gx = (*gFunction_)(x);
474 const Real GR = (*gFunction_)(forwardValue_);
475 return (x -
strike_) * (Gx/GR - 1.0);
479 const Real Gx = (*gFunction_)(x);
480 const Real GR = (*gFunction_)(forwardValue_) ;
482 return (Gx/GR - 1.0) + G1/GR * (x -
strike_);
486 const Real GR = (*gFunction_)(forwardValue_) ;
489 return 2.0 * G1/GR + (x -
strike_) *
G2/GR;
493 const Real option = (*vanillaOptionPricer_)(x, optionType_,
annuity_);
494 return option * secondDerivativeOfF(x);
516 Real firstDerivativeOfGAtForwardValue =
gFunction_->firstDerivative(
520 Real CK = (*vanillaOptionPricer_)(strike, optionType,
annuity_);
526 const Real d32 = (lnRoverK + 1.5*
variance) / sqrtSigma2T;
527 const Real d12 = (lnRoverK + .5*
variance) / sqrtSigma2T;
528 const Real dminus12 = (lnRoverK - .5*
variance) / sqrtSigma2T;
531 auto sign =
Integer(optionType);
532 const Real N32 = cumulativeOfNormal(sign*d32);
533 const Real N12 = cumulativeOfNormal(sign*d12);
534 const Real Nminus12 = cumulativeOfNormal(sign*dminus12);
536 price += sign * firstDerivativeOfGAtForwardValue *
annuity_ *
544 auto sign =
Integer(optionType);
546 const Real N = cumulativeOfNormal(sign*
d);
568 Real firstDerivativeOfGAtForwardValue(
gFunction_->firstDerivative(
590 return x / std::pow((1.0 + x/
q_),
delta_) * 1.0 /
591 (1.0 - 1.0 / std::pow((1.0 + x/
q_),
n));
595 Real n =
static_cast<Real>(swapLength_) * q_;
596 Real a = 1.0 + x / q_;
597 Real AA = a - delta_/q_ * x;
598 Real B = std::pow(a,(
n - delta_ - 1.0))/(std::pow(a,
n) - 1.0);
600 Real secNum =
n * x * std::pow(a,(
n-1.0));
601 Real secDen = q_ * std::pow(a, delta_) * (std::pow(a,
n) - 1.0) *
602 (std::pow(a,
n) - 1.0);
603 Real sec = secNum / secDen;
609 Real n =
static_cast<Real>(swapLength_) * q_;
611 Real AA = a - delta_/q_ * x;
612 Real A1 = (1.0 - delta_)/q_;
613 Real B = std::pow(a,(
n - delta_ - 1.0))/(std::pow(a,
n) - 1.0);
614 Real Num = (1.0 + delta_ -
n) * std::pow(a, (
n-delta_-2.0)) -
615 (1.0 + delta_) * std::pow(a, (2.0*
n-delta_-2.0));
616 Real Den = (std::pow(a,
n) - 1.0) * (std::pow(a,
n) - 1.0);
617 Real B1 = 1.0 / q_ * Num / Den;
619 Real C = x / std::pow(a, delta_);
620 Real C1 = (std::pow(a, delta_)
621 - delta_ /q_ * x * std::pow(a, (delta_ - 1.0))) / std::pow(a, 2 * delta_);
623 Real D = std::pow(a, (
n-1.0))/ ((std::pow(a,
n) - 1.0) * (std::pow(a,
n) - 1.0));
624 Real D1 = ((
n - 1.0) * std::pow(a, (
n-2.0)) * (std::pow(a,
n) - 1.0)
625 - 2 *
n * std::pow(a, (2 * (
n-1.0))))
626 / (q_ * (std::pow(a,
n) - 1.0)*(std::pow(a,
n) - 1.0)*(std::pow(a,
n) - 1.0));
628 return A1 * B + AA * B1 -
n/q_ * (C1 * D + C * D1);
642 const ext::shared_ptr<SwapIndex>& swapIndex = coupon.
swapIndex();
643 const ext::shared_ptr<VanillaSwap>&
swap =
644 swapIndex->underlyingSwap(coupon.
fixingDate());
648 swapIndex->forwardingTermStructure();
650 const DayCounter& dc = swapIndex->dayCounter();
660 delta_ = (paymentTime-swapStartTime) / (swapFirstPaymentTime-swapStartTime);
662 const Leg& fixedLeg(
swap->fixedLeg());
663 Size n = fixedLeg.size();
664 accruals_.reserve(
n);
665 for (
Size i=0; i<
n; ++i) {
666 ext::shared_ptr<Coupon> cpn =
667 ext::dynamic_pointer_cast<Coupon>(fixedLeg[i]);
668 accruals_.push_back(cpn->accrualPeriod());
674 for (
Real accrual : accruals_) {
675 product *= 1. / (1. + accrual * x);
677 return x*std::pow(1.+ accruals_[0]*x,-delta_)*(1./(1.-product));
684 b.reserve(accruals_.size());
685 for (
Real accrual : accruals_) {
686 Real temp = 1.0 / (1.0 + accrual * x);
689 derC += accrual * temp;
695 return -delta_*accruals_[0]*std::pow(
b[0],delta_+1.)*x*c+
696 std::pow(
b[0],delta_)*c+ std::pow(
b[0],delta_)*x*derC;
704 Real sumOfSquare = 0.;
706 b.reserve(accruals_.size());
707 for (
Real accrual : accruals_) {
708 Real temp = 1.0 / (1.0 + accrual * x);
711 sum += accrual * temp;
712 sumOfSquare += std::pow(accrual * temp, 2.0);
716 Real derC =sum*(c-c*c);
718 return (-delta_*accruals_[0]*std::pow(
b[0],delta_+1.)*c+ std::pow(
b[0],delta_)*derC)*
719 (-delta_*accruals_[0]*
b[0]*x + 1. + x*(1.-c)*sum)+
720 std::pow(
b[0],delta_)*c*(delta_*std::pow(accruals_[0]*
b[0],2.)*x - delta_* accruals_[0]*
b[0] -
721 x*derC*sum + (1.-c)*sum - x*(1.-c)*sumOfSquare);
738 : meanReversion_(
std::move(meanReversion)) {
740 const ext::shared_ptr<SwapIndex>& swapIndex = coupon.
swapIndex();
741 const ext::shared_ptr<VanillaSwap>&
swap = swapIndex->underlyingSwap(coupon.
fixingDate());
749 swapIndex->forwardingTermStructure();
750 const DayCounter& dc = swapIndex->dayCounter();
761 const Leg& fixedLeg(
swap->fixedLeg());
762 Size n = fixedLeg.size();
766 for(
Size i=0; i<
n; ++i) {
767 ext::shared_ptr<Coupon> cpn =
768 ext::dynamic_pointer_cast<Coupon>(fixedLeg[i]);
769 accruals_.push_back(cpn->accrualPeriod());
770 const Date paymentDate(cpn->date());
771 const Real swapPaymentTime(dc.
yearFraction(rateCurve->referenceDate(), paymentDate));
779 const Real calibratedShift = calibrationOfShift(Rs);
780 return Rs* functionZ(calibratedShift);
784 return std::exp(-shapedPaymentTime_*x)
785 / (1.-discountRatio_*std::exp(-shapedSwapPaymentTimes_.back()*x));
789 Real sqrtDenominator = 0;
790 Real derSqrtDenominator = 0;
791 for(
Size i=0; i<accruals_.size(); i++) {
792 sqrtDenominator += accruals_[i]*swapPaymentDiscounts_[i]
793 *std::exp(-shapedSwapPaymentTimes_[i]*x);
794 derSqrtDenominator -= shapedSwapPaymentTimes_[i]* accruals_[i]*swapPaymentDiscounts_[i]
795 *std::exp(-shapedSwapPaymentTimes_[i]*x);
797 const Real denominator = sqrtDenominator* sqrtDenominator;
800 numerator += shapedSwapPaymentTimes_.back()* swapPaymentDiscounts_.back()*
801 std::exp(-shapedSwapPaymentTimes_.back()*x)*sqrtDenominator;
802 numerator -= (discountAtStart_ - swapPaymentDiscounts_.back()* std::exp(-shapedSwapPaymentTimes_.back()*x))*
804 QL_REQUIRE(denominator!=0,
"GFunctionWithShifts::derRs_derX: denominator == 0");
805 return numerator/denominator;
809 Real denOfRfunztion = 0.;
810 Real derDenOfRfunztion = 0.;
811 Real der2DenOfRfunztion = 0.;
812 for(
Size i=0; i<accruals_.size(); i++) {
813 denOfRfunztion += accruals_[i]*swapPaymentDiscounts_[i]
814 *std::exp(-shapedSwapPaymentTimes_[i]*x);
815 derDenOfRfunztion -= shapedSwapPaymentTimes_[i]* accruals_[i]*swapPaymentDiscounts_[i]
816 *std::exp(-shapedSwapPaymentTimes_[i]*x);
817 der2DenOfRfunztion+= shapedSwapPaymentTimes_[i]*shapedSwapPaymentTimes_[i]* accruals_[i]*
818 swapPaymentDiscounts_[i]*std::exp(-shapedSwapPaymentTimes_[i]*x);
821 const Real denominator = std::pow(denOfRfunztion, 4);
824 numOfDerR += shapedSwapPaymentTimes_.back()* swapPaymentDiscounts_.back()*
825 std::exp(-shapedSwapPaymentTimes_.back()*x)*denOfRfunztion;
826 numOfDerR -= (discountAtStart_ - swapPaymentDiscounts_.back()* std::exp(-shapedSwapPaymentTimes_.back()*x))*
829 const Real denOfDerR = std::pow(denOfRfunztion,2);
831 Real derNumOfDerR = 0.;
832 derNumOfDerR -= shapedSwapPaymentTimes_.back()*shapedSwapPaymentTimes_.back()* swapPaymentDiscounts_.back()*
833 std::exp(-shapedSwapPaymentTimes_.back()*x)*denOfRfunztion;
834 derNumOfDerR += shapedSwapPaymentTimes_.back()* swapPaymentDiscounts_.back()*
835 std::exp(-shapedSwapPaymentTimes_.back()*x)*derDenOfRfunztion;
837 derNumOfDerR -= (shapedSwapPaymentTimes_.back()*swapPaymentDiscounts_.back()*
838 std::exp(-shapedSwapPaymentTimes_.back()*x))* derDenOfRfunztion;
839 derNumOfDerR -= (discountAtStart_ - swapPaymentDiscounts_.back()* std::exp(-shapedSwapPaymentTimes_.back()*x))*
842 const Real derDenOfDerR = 2*denOfRfunztion*derDenOfRfunztion;
844 const Real numerator = derNumOfDerR*denOfDerR -numOfDerR*derDenOfDerR;
845 QL_REQUIRE(denominator!=0,
"GFunctionWithShifts::der2Rs_derX2: denominator == 0");
846 return numerator/denominator;
850 const Real sqrtDenominator = (1.-discountRatio_*std::exp(-shapedSwapPaymentTimes_.back()*x));
851 const Real denominator = sqrtDenominator* sqrtDenominator;
852 QL_REQUIRE(denominator!=0,
"GFunctionWithShifts::derZ_derX: denominator == 0");
855 numerator -= shapedPaymentTime_* std::exp(-shapedPaymentTime_*x)* sqrtDenominator;
856 numerator -= shapedSwapPaymentTimes_.back()* std::exp(-shapedPaymentTime_*x)* (1.-sqrtDenominator);
858 return numerator/denominator;
862 const Real denOfZfunction = (1.-discountRatio_*std::exp(-shapedSwapPaymentTimes_.back()*x));
863 const Real derDenOfZfunction = shapedSwapPaymentTimes_.back()*discountRatio_*std::exp(-shapedSwapPaymentTimes_.back()*x);
864 const Real denominator = std::pow(denOfZfunction, 4);
865 QL_REQUIRE(denominator!=0,
"GFunctionWithShifts::der2Z_derX2: denominator == 0");
868 numOfDerZ -= shapedPaymentTime_* std::exp(-shapedPaymentTime_*x)* denOfZfunction;
869 numOfDerZ -= shapedSwapPaymentTimes_.back()* std::exp(-shapedPaymentTime_*x)* (1.-denOfZfunction);
871 const Real denOfDerZ = std::pow(denOfZfunction,2);
872 const Real derNumOfDerZ = (-shapedPaymentTime_* std::exp(-shapedPaymentTime_*x)*
873 (-shapedPaymentTime_+(shapedPaymentTime_*discountRatio_-
874 shapedSwapPaymentTimes_.back()*discountRatio_)* std::exp(-shapedSwapPaymentTimes_.back()*x))
875 -shapedSwapPaymentTimes_.back()*std::exp(-shapedPaymentTime_*x)*
876 (shapedPaymentTime_*discountRatio_- shapedSwapPaymentTimes_.back()*discountRatio_)*
877 std::exp(-shapedSwapPaymentTimes_.back()*x));
879 const Real derDenOfDerZ = 2*denOfZfunction*derDenOfZfunction;
880 const Real numerator = derNumOfDerZ*denOfDerZ -numOfDerZ*derDenOfDerZ;
882 return numerator/denominator;
888 const Real calibratedShift = calibrationOfShift(Rs);
889 return functionZ(calibratedShift) + Rs * derZ_derX(calibratedShift)/derRs_derX(calibratedShift);
895 const Real calibratedShift = calibrationOfShift(Rs);
896 return 2.*derZ_derX(calibratedShift)/derRs_derX(calibratedShift) +
897 Rs * der2Z_derX2(calibratedShift)/std::pow(derRs_derX(calibratedShift),2.)-
898 Rs * derZ_derX(calibratedShift)*der2Rs_derX2(calibratedShift)/
899 std::pow(derRs_derX(calibratedShift),3.);
905 for(
Size i=0; i<o_.accruals_.size(); i++) {
906 Real temp = o_.accruals_[i]*o_.swapPaymentDiscounts_[i]
907 *std::exp(-o_.shapedSwapPaymentTimes_[i]*x);
909 derivative_ -= o_.shapedSwapPaymentTimes_[i] * temp;
913 Real temp = o_.swapPaymentDiscounts_.back()
914 * std::exp(-o_.shapedSwapPaymentTimes_.back()*x);
916 result += temp-o_.discountAtStart_;
917 derivative_ -= o_.shapedSwapPaymentTimes_.back()*temp;
930 const Real x(
s-swapStartTime_);
931 Real meanReversion = meanReversion_->value();
932 if(meanReversion>0) {
933 return (1.-std::exp(-meanReversion*x))/meanReversion;
943 Real initialGuess, N=0, D=0;
944 for(
Size i=0; i<accruals_.size(); i++) {
945 N+=accruals_[i]*swapPaymentDiscounts_[i];
946 D+=accruals_[i]*swapPaymentDiscounts_[i]*shapedSwapPaymentTimes_[i];
950 N += accruals_.back() * swapPaymentDiscounts_.back()
951 - objectiveFunction_->gFunctionWithShifts().discountAtStart_;
952 D += accruals_.back() * swapPaymentDiscounts_.back()*
953 shapedSwapPaymentTimes_.back();
956 objectiveFunction_->setSwapRateValue(Rs);
964 const Real lower = -20, upper = 20.;
967 calibratedShift_ = solver.
solve(*objectiveFunction_, accuracy_,
968 std::max( std::min(initialGuess, upper*.99), lower*.99),
970 }
catch (std::exception& e) {
971 QL_FAIL(
"meanReversion: " << meanReversion_->value() <<
972 ", swapRateValue: " << swapRateValue_ <<
973 ", swapStartTime: " << swapStartTime_ <<
974 ", shapedPaymentTime: " << shapedPaymentTime_ <<
975 "\n error message: " << e.what());
979 return calibratedShift_;
AnalyticHaganPricer(const Handle< SwaptionVolatilityStructure > &swaptionVol, GFunctionFactory::YieldCurveModel modelOfYieldCurve, const Handle< Quote > &meanReversion)
Real optionletPrice(Option::Type optionType, Real strike) const override
Real swapletPrice() const override
const ext::shared_ptr< SwapIndex > & swapIndex() const
base pricer for vanilla CMS coupons
Handle< SwaptionVolatilityStructure > swaptionVolatility() const
Date date() const override
Time accrualPeriod() const
accrual period as fraction of year
Cumulative normal distribution function.
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.
base floating-rate coupon class
virtual Date fixingDate() const
fixing date
Real gearing() const
index gearing, i.e. multiplicative coefficient for the index
Spread spread() const
spread paid over the fixing of the underlying index
Two-additive-factor gaussian model class.
Real firstDerivative(Real x) override
Real operator()(Real x) override
Real secondDerivative(Real x) override
GFunctionExactYield(const CmsCoupon &coupon)
Real firstDerivative(Real x) override
Real operator()(Real x) override
Real secondDerivative(Real x) override
virtual Real operator()(const Real &x) const
void setSwapRateValue(Real x)
Real derivative(const Real &x) const
Real firstDerivative(Real x) override
Real operator()(Real x) override
GFunctionWithShifts(const CmsCoupon &coupon, Handle< Quote > meanReversion)
std::vector< Time > accruals_
Real shapeOfShift(Real s) const
Real der2Rs_derX2(Real x)
std::vector< Time > shapedSwapPaymentTimes_
ext::shared_ptr< ObjectiveFunction > objectiveFunction_
Real secondDerivative(Real x) override
Real calibrationOfShift(Real Rs)
std::vector< Real > swapPaymentDiscounts_
static ext::shared_ptr< GFunction > newGFunctionExactYield(const CmsCoupon &coupon)
static ext::shared_ptr< GFunction > newGFunctionStandard(Size q, Real delta, Size swapLength)
static ext::shared_ptr< GFunction > newGFunctionWithShifts(const CmsCoupon &coupon, const Handle< Quote > &meanReversion)
Integral of a 1-dimensional function using the Gauss-Kronrod methods.
Integral of a 1-dimensional function using the Gauss-Kronrod methods.
ext::shared_ptr< GFunction > gFunction_
const CmsCoupon * coupon_
Real capletPrice(Rate effectiveCap) const override
Rate floorletRate(Rate effectiveFloor) const override
Handle< Quote > meanReversion_
void initialize(const FloatingRateCoupon &coupon) override
virtual Real optionletPrice(Option::Type optionType, Real strike) const =0
ext::shared_ptr< VanillaOptionPricer > vanillaOptionPricer_
GFunctionFactory::YieldCurveModel modelOfYieldCurve_
ext::shared_ptr< YieldTermStructure > rateCurve_
Real swapletPrice() const override=0
HaganPricer(const Handle< SwaptionVolatilityStructure > &swaptionVol, GFunctionFactory::YieldCurveModel modelOfYieldCurve, Handle< Quote > meanReversion)
Rate swapletRate() const override
Real floorletPrice(Rate effectiveFloor) const override
Real meanReversion() const override
Rate capletRate(Rate effectiveCap) const override
Shared handle to an observable.
virtual bool integrationSuccess() const
ext::shared_ptr< SwaptionVolatilityStructure > volatilityStructure_
ext::shared_ptr< SmileSection > smile_
MarketQuotedOptionPricer(Rate forwardValue, Date expiryDate, const Period &swapTenor, const ext::shared_ptr< SwaptionVolatilityStructure > &volatilityStructure)
Real operator()(Real strike, Option::Type optionType, Real deflator) const override
Real functionF(Real x) const
void setStrike(Real strike)
Real firstDerivativeOfF(Real x) const
Real operator()(Real x) const override
ConundrumIntegrand(ext::shared_ptr< VanillaOptionPricer > o, const ext::shared_ptr< YieldTermStructure > &rateCurve, ext::shared_ptr< GFunction > gFunction, Date fixingDate, Date paymentDate, Real annuity, Real forwardValue, Real strike, Option::Type optionType)
Real secondDerivativeOfF(Real x) const
Real optionletPrice(Option::Type optionType, Rate strike) const override
Real resetLowerLimit(Real stdDeviationsForLowerLimit) const
const Real hardUpperLimit_
const Real requiredStdDeviations_
const Real refiningIntegrationTolerance_
Real stdDeviationsForUpperLimit_
Real resetUpperLimit(Real stdDeviationsForUpperLimit) const
NumericHaganPricer(const Handle< SwaptionVolatilityStructure > &swaptionVol, GFunctionFactory::YieldCurveModel modelOfYieldCurve, const Handle< Quote > &meanReversion, Rate lowerLimit=0.0, Rate upperLimit=1.0, Real precision=1.0e-6, Real hardUpperLimit=QL_MAX_REAL)
Real integrate(Real a, Real b, const ConundrumIntegrand &Integrand) const
Real stdDeviationsForLowerLimit_
Real swapletPrice() const override
Real refineIntegration(Real integralValue, const ConundrumIntegrand &integrand) const
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
const Date & startDate() const
const Date & date(Size i) const
DateProxy & evaluationDate()
the date at which pricing is to be performed.
market element returning a stored value
static Settings & instance()
access to the unique instance
void setMaxEvaluations(Size evaluations)
Real solve(const F &f, Real accuracy, Real guess, Real step) const
ext::function< Real(Real)> f_
std::vector< Real > abscissas
std::vector< Real > functionValues
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
#define QL_FAIL(message)
throw an error (possibly with file and line information)
ext::function< Real(Real)> b
LinearInterpolation variance
Maps function, bind and cref to either the boost or std implementation.
Real Time
continuous quantity with 1-year units
QL_INTEGER Integer
integer number
Real Spread
spreads on interest rates
std::size_t Size
size of a container
base class for interest rate indexes
Integral of a 1-dimensional function using the Gauss-Kronrod method.
Real bachelierBlackFormula(Option::Type optionType, Real strike, Real forward, Real stdDev, Real discount)
void swap(Array &v, Array &w) noexcept
Real blackFormula(Option::Type optionType, Real strike, Real forward, Real stdDev, Real discount, Real displacement)
bool close_enough(const Quantity &m1, const Quantity &m2, Size n)
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
normal, cumulative and inverse cumulative distributions
ext::shared_ptr< YieldTermStructure > q
Smile section base class.
Simple fixed-rate vs Libor swap.
Interest-rate term structure.