Skip to content

Commit 9c823e4

Browse files
pcaspersjenkins
authored andcommitted
QPR-12159 fixes
1 parent 7242d36 commit 9c823e4

1 file changed

Lines changed: 34 additions & 23 deletions

File tree

OREData/ored/marketdata/yieldcurve.cpp

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,15 @@ boost::shared_ptr<YieldTermStructure> buildYieldCurve(const vector<Date>& dates,
154154
new CurveType<KrugerLogMixedLinearCubic>(dates, rates, dayCounter, KrugerLogMixedLinearCubic(n)));
155155
break;
156156
case YieldCurve::InterpolationMethod::LogMixedLinearCubicNaturalSpline:
157-
yieldts.reset(new CurveType<LogMixedLinearCubicNaturalSpline>(dates, rates, dayCounter,
158-
LogMixedLinearCubicNaturalSpline(n)));
157+
yieldts.reset(new CurveType<LogMixedLinearCubic>(
158+
dates, rates, dayCounter,
159+
LogMixedLinearCubic(n, MixedInterpolation::ShareRanges, CubicInterpolation::Spline, false,
160+
CubicInterpolation::SecondDerivative, 0.0, CubicInterpolation::SecondDerivative,
161+
0.0)));
159162
break;
160163

161164
default:
162-
QL_FAIL("Interpolation method '" << interpolationMethod_ << "' not recognised.");
165+
QL_FAIL("Interpolation method '" << interpolationMethod << "' not recognised.");
163166
}
164167
return yieldts;
165168
}
@@ -483,31 +486,34 @@ YieldCurve::piecewisecurve(vector<boost::shared_ptr<RateHelper>> instruments) {
483486
typedef PiecewiseYieldCurve<ZeroYield, DefaultLogMixedLinearCubic, QuantExt::IterativeBootstrap> my_curve;
484487
ATTR_UNUSED typedef my_curve::traits_type dummy;
485488
yieldts = boost::make_shared<my_curve>(
486-
asofDate_, instruments, zeroDayCounter_, DefaultLogMixedLinearCubic(n),
489+
asofDate_, instruments, zeroDayCounter_, DefaultLogMixedLinearCubic(mixedInterpolationSize_),
487490
QuantExt::IterativeBootstrap<my_curve>(accuracy, globalAccuracy, dontThrow, maxAttempts, maxFactor,
488491
minFactor, dontThrowSteps));
489492
} break;
490493
case InterpolationMethod::MonotonicLogMixedLinearCubic: {
491494
typedef PiecewiseYieldCurve<ZeroYield, MonotonicLogMixedLinearCubic, QuantExt::IterativeBootstrap> my_curve;
492495
ATTR_UNUSED typedef my_curve::traits_type dummy;
493496
yieldts = boost::make_shared<my_curve>(
494-
asofDate_, instruments, zeroDayCounter_, MonotonicLogMixedLinearCubic(n),
497+
asofDate_, instruments, zeroDayCounter_, MonotonicLogMixedLinearCubic(mixedInterpolationSize_),
495498
QuantExt::IterativeBootstrap<my_curve>(accuracy, globalAccuracy, dontThrow, maxAttempts, maxFactor,
496499
minFactor, dontThrowSteps));
497500
} break;
498501
case InterpolationMethod::KrugerLogMixedLinearCubic: {
499502
typedef PiecewiseYieldCurve<ZeroYield, KrugerLogMixedLinearCubic, QuantExt::IterativeBootstrap> my_curve;
500503
ATTR_UNUSED typedef my_curve::traits_type dummy;
501504
yieldts = boost::make_shared<my_curve>(
502-
asofDate_, instruments, zeroDayCounter_, KrugerLogMixedLinearCubic(n),
505+
asofDate_, instruments, zeroDayCounter_, KrugerLogMixedLinearCubic(mixedInterpolationSize_),
503506
QuantExt::IterativeBootstrap<my_curve>(accuracy, globalAccuracy, dontThrow, maxAttempts, maxFactor,
504507
minFactor, dontThrowSteps));
505508
} break;
506509
case InterpolationMethod::LogMixedLinearCubicNaturalSpline: {
507-
typedef PiecewiseYieldCurve<ZeroYield, LogMixedLinearCubicNaturalSpline, QuantExt::IterativeBootstrap> my_curve;
510+
typedef PiecewiseYieldCurve<ZeroYield, LogMixedLinearCubic, QuantExt::IterativeBootstrap> my_curve;
508511
ATTR_UNUSED typedef my_curve::traits_type dummy;
509512
yieldts = boost::make_shared<my_curve>(
510-
asofDate_, instruments, zeroDayCounter_, LogMixedLinearCubicNaturalSpline(n),
513+
asofDate_, instruments, zeroDayCounter_,
514+
LogMixedLinearCubic(mixedInterpolationSize_, MixedInterpolation::ShareRanges,
515+
CubicInterpolation::Spline, false, CubicInterpolation::SecondDerivative, 0.0,
516+
CubicInterpolation::SecondDerivative, 0.0),
511517
QuantExt::IterativeBootstrap<my_curve>(accuracy, globalAccuracy, dontThrow, maxAttempts, maxFactor,
512518
minFactor, dontThrowSteps));
513519
} break;
@@ -580,11 +586,10 @@ YieldCurve::piecewisecurve(vector<boost::shared_ptr<RateHelper>> instruments) {
580586
case InterpolationMethod::Quadratic: {
581587
typedef PiecewiseYieldCurve<Discount, QuantExt::Quadratic, QuantExt::IterativeBootstrap> my_curve;
582588
ATTR_UNUSED typedef my_curve::traits_type dummy;
583-
yieldts =
584-
boost::make_shared<my_curve>(
585-
asofDate_, instruments, zeroDayCounter_, QuantExt::Quadratic(1, 0, 1, 0, 1),
586-
QuantExt::IterativeBootstrap<my_curve>(accuracy, globalAccuracy, dontThrow, maxAttempts, maxFactor,
587-
minFactor, dontThrowSteps));
589+
yieldts = boost::make_shared<my_curve>(
590+
asofDate_, instruments, zeroDayCounter_, QuantExt::Quadratic(1, 0, 1, 0, 1),
591+
QuantExt::IterativeBootstrap<my_curve>(accuracy, globalAccuracy, dontThrow, maxAttempts, maxFactor,
592+
minFactor, dontThrowSteps));
588593
} break;
589594
case InterpolationMethod::LogQuadratic: {
590595
typedef PiecewiseYieldCurve<Discount, QuantExt::LogQuadratic, QuantExt::IterativeBootstrap> my_curve;
@@ -598,31 +603,34 @@ YieldCurve::piecewisecurve(vector<boost::shared_ptr<RateHelper>> instruments) {
598603
typedef PiecewiseYieldCurve<Discount, DefaultLogMixedLinearCubic, QuantExt::IterativeBootstrap> my_curve;
599604
ATTR_UNUSED typedef my_curve::traits_type dummy;
600605
yieldts = boost::make_shared<my_curve>(
601-
asofDate_, instruments, zeroDayCounter_, DefaultLogMixedLinearCubic(n),
606+
asofDate_, instruments, zeroDayCounter_, DefaultLogMixedLinearCubic(mixedInterpolationSize_),
602607
QuantExt::IterativeBootstrap<my_curve>(accuracy, globalAccuracy, dontThrow, maxAttempts, maxFactor,
603608
minFactor, dontThrowSteps));
604609
} break;
605610
case InterpolationMethod::MonotonicLogMixedLinearCubic: {
606611
typedef PiecewiseYieldCurve<Discount, MonotonicLogMixedLinearCubic, QuantExt::IterativeBootstrap> my_curve;
607612
ATTR_UNUSED typedef my_curve::traits_type dummy;
608613
yieldts = boost::make_shared<my_curve>(
609-
asofDate_, instruments, zeroDayCounter_, MonotonicLogMixedLinearCubic(n),
614+
asofDate_, instruments, zeroDayCounter_, MonotonicLogMixedLinearCubic(mixedInterpolationSize_),
610615
QuantExt::IterativeBootstrap<my_curve>(accuracy, globalAccuracy, dontThrow, maxAttempts, maxFactor,
611616
minFactor, dontThrowSteps));
612617
} break;
613618
case InterpolationMethod::KrugerLogMixedLinearCubic: {
614619
typedef PiecewiseYieldCurve<Discount, KrugerLogMixedLinearCubic, QuantExt::IterativeBootstrap> my_curve;
615620
ATTR_UNUSED typedef my_curve::traits_type dummy;
616621
yieldts = boost::make_shared<my_curve>(
617-
asofDate_, instruments, zeroDayCounter_, KrugerLogMixedLinearCubic(n),
622+
asofDate_, instruments, zeroDayCounter_, KrugerLogMixedLinearCubic(mixedInterpolationSize_),
618623
QuantExt::IterativeBootstrap<my_curve>(accuracy, globalAccuracy, dontThrow, maxAttempts, maxFactor,
619624
minFactor, dontThrowSteps));
620625
} break;
621626
case InterpolationMethod::LogMixedLinearCubicNaturalSpline: {
622-
typedef PiecewiseYieldCurve<Discount, LogMixedLinearCubicNaturalSpline, QuantExt::IterativeBootstrap> my_curve;
627+
typedef PiecewiseYieldCurve<Discount, LogMixedLinearCubic, QuantExt::IterativeBootstrap> my_curve;
623628
ATTR_UNUSED typedef my_curve::traits_type dummy;
624629
yieldts = boost::make_shared<my_curve>(
625-
asofDate_, instruments, zeroDayCounter_, LogMixedLinearCubicNaturalSpline(n),
630+
asofDate_, instruments, zeroDayCounter_,
631+
LogMixedLinearCubic(mixedInterpolationSize_, MixedInterpolation::ShareRanges,
632+
CubicInterpolation::Spline, false, CubicInterpolation::SecondDerivative, 0.0,
633+
CubicInterpolation::SecondDerivative, 0.0),
626634
QuantExt::IterativeBootstrap<my_curve>(accuracy, globalAccuracy, dontThrow, maxAttempts, maxFactor,
627635
minFactor, dontThrowSteps));
628636
} break;
@@ -712,31 +720,34 @@ YieldCurve::piecewisecurve(vector<boost::shared_ptr<RateHelper>> instruments) {
712720
typedef PiecewiseYieldCurve<ForwardRate, DefaultLogMixedLinearCubic, QuantExt::IterativeBootstrap> my_curve;
713721
ATTR_UNUSED typedef my_curve::traits_type dummy;
714722
yieldts = boost::make_shared<my_curve>(
715-
asofDate_, instruments, zeroDayCounter_, DefaultLogMixedLinearCubic(n),
723+
asofDate_, instruments, zeroDayCounter_, DefaultLogMixedLinearCubic(mixedInterpolationSize_),
716724
QuantExt::IterativeBootstrap<my_curve>(accuracy, globalAccuracy, dontThrow, maxAttempts, maxFactor,
717725
minFactor, dontThrowSteps));
718726
} break;
719727
case InterpolationMethod::MonotonicLogMixedLinearCubic: {
720728
typedef PiecewiseYieldCurve<ForwardRate, MonotonicLogMixedLinearCubic, QuantExt::IterativeBootstrap> my_curve;
721729
ATTR_UNUSED typedef my_curve::traits_type dummy;
722730
yieldts = boost::make_shared<my_curve>(
723-
asofDate_, instruments, zeroDayCounter_, MonotonicLogMixedLinearCubic(n),
731+
asofDate_, instruments, zeroDayCounter_, MonotonicLogMixedLinearCubic(mixedInterpolationSize_),
724732
QuantExt::IterativeBootstrap<my_curve>(accuracy, globalAccuracy, dontThrow, maxAttempts, maxFactor,
725733
minFactor, dontThrowSteps));
726734
} break;
727735
case InterpolationMethod::KrugerLogMixedLinearCubic: {
728736
typedef PiecewiseYieldCurve<ForwardRate, KrugerLogMixedLinearCubic, QuantExt::IterativeBootstrap> my_curve;
729737
ATTR_UNUSED typedef my_curve::traits_type dummy;
730738
yieldts = boost::make_shared<my_curve>(
731-
asofDate_, instruments, zeroDayCounter_, KrugerLogMixedLinearCubic(n),
739+
asofDate_, instruments, zeroDayCounter_, KrugerLogMixedLinearCubic(mixedInterpolationSize_),
732740
QuantExt::IterativeBootstrap<my_curve>(accuracy, globalAccuracy, dontThrow, maxAttempts, maxFactor,
733741
minFactor, dontThrowSteps));
734742
} break;
735743
case InterpolationMethod::LogMixedLinearCubicNaturalSpline: {
736-
typedef PiecewiseYieldCurve<ForwardRate, LogMixedLinearCubicNaturalSpline, QuantExt::IterativeBootstrap> my_curve;
744+
typedef PiecewiseYieldCurve<ForwardRate, LogMixedLinearCubic, QuantExt::IterativeBootstrap> my_curve;
737745
ATTR_UNUSED typedef my_curve::traits_type dummy;
738746
yieldts = boost::make_shared<my_curve>(
739-
asofDate_, instruments, zeroDayCounter_, LogMixedLinearCubicNaturalSpline(n),
747+
asofDate_, instruments, zeroDayCounter_,
748+
LogMixedLinearCubic(mixedInterpolationSize_, MixedInterpolation::ShareRanges,
749+
CubicInterpolation::Spline, false, CubicInterpolation::SecondDerivative, 0.0,
750+
CubicInterpolation::SecondDerivative, 0.0),
740751
QuantExt::IterativeBootstrap<my_curve>(accuracy, globalAccuracy, dontThrow, maxAttempts, maxFactor,
741752
minFactor, dontThrowSteps));
742753
} break;

0 commit comments

Comments
 (0)