Caplet stripping by bootstrap #1422

Merged
merged 14 commits into from Dec 19, 2016

Conversation

Projects
None yet
2 participants
@yukiiwashita
Member

yukiiwashita commented Nov 28, 2016

  • Two implementations of caplet stripping based on bootstrapping: SurfaceIborCapletFloorletVolatilityBootstrapper and SabrIborCapletFloorletVolatilityBootstrapper.
  • Created IborCapletFloorletDefinition.
  • Added a new metadata, GenericVolatilitySurfacePeriodParameterMetadata.
  • Implemented StepUpperCurveInterpolator.
+ * The chi-square value.
+ * <p>
+ * The chi square is 0 if the volatilities are computed by root-finding.
+ * The chi square is generally non-zeoro if the volatilities are computed by least square method.

This comment has been minimized.

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

Spelling 'non-zero'

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

Spelling 'non-zero'

+ * @param chiSquare the chi-square value
+ * @return the instance
+ */
+ public static IborCapletFloorletVolatilityCalibrationResult ofLestSquare(

This comment has been minimized.

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

method name spelling

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

method name spelling

+ * Default implementation.
+ */
+ public static final SabrIborCapletFloorletVolatilityBootstrapper DEFAULT = of(
+ VolatilityIborCapFloorLegPricer.DEFAULT, SabrIborCapletFloorletPeriodPricer.DEFAULT, 1.0e-10, ReferenceData.standard());

This comment has been minimized.

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

Do we need both leg and period pricer?

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

Do we need both leg and period pricer?

This comment has been minimized.

@yukiiwashita

yukiiwashita Dec 14, 2016

Member

The first pricer is used to convert the market vols to prices, whereas the second pricer is used for calibration to SABR model, that is, the second one must be SABR rather than generic VolatilityIborCapletFloorletPeriodPricer. In this case, 'validate(IborCapletFloorletVolatilities)' is overridden and the pricer works only when IborCapletFloorletVolatilities is an instance of SabrIborCapletFloorletVolatilities. Thus this pricer (or its leg version SabrIborCapFloorLegPricer) can not be used for the vol-to-price conversion.

@yukiiwashita

yukiiwashita Dec 14, 2016

Member

The first pricer is used to convert the market vols to prices, whereas the second pricer is used for calibration to SABR model, that is, the second one must be SABR rather than generic VolatilityIborCapletFloorletPeriodPricer. In this case, 'validate(IborCapletFloorletVolatilities)' is overridden and the pricer works only when IborCapletFloorletVolatilities is an instance of SabrIborCapletFloorletVolatilities. Thus this pricer (or its leg version SabrIborCapFloorLegPricer) can not be used for the vol-to-price conversion.

+ TRANSFORMS[0] = new SingleRangeLimitTransform(0, LimitType.GREATER_THAN); // alpha > 0
+ TRANSFORMS[1] = new DoubleRangeLimitTransform(0.0, 1.0); // 0 <= beta <= 1
+ TRANSFORMS[2] = new DoubleRangeLimitTransform(-RHO_LIMIT, RHO_LIMIT); // -1 <= rho <= 1
+ TRANSFORMS[3] = new SingleRangeLimitTransform(0, LimitType.GREATER_THAN);

This comment has been minimized.

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

Stability for large nu? See SabrModelFitter

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

Stability for large nu? See SabrModelFitter

+ /**
+ * The period of the surface node.
+ * <p>
+ * This is the period to maturity that the node on the surface is defined as.

This comment has been minimized.

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

Maturity or expiry?

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

Maturity or expiry?

+ * <p>
+ * The caplet volatilities are computed by bootstrapping along the expiry time dimension.
+ * The result is an interpolated surface spanned by expiry and strike.
+ * The position of the node points on the resultant surface corresponds to market caps.

This comment has been minimized.

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

Which part of the cap on the expiry dimension? Last expiry date?

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

Which part of the cap on the expiry dimension? Last expiry date?

+/**
+ * Definition of caplet volatilities calibration.
+ */
+public interface IborCapletFloorletDefinition {

This comment has been minimized.

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

Should we have 'Volatility' in the name?

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

Should we have 'Volatility' in the name?

+ DoubleArray strikeShifted = DoubleArray.of(nTotal, n -> strikeList.get(n) + shiftCurve.yValue(timeList.get(n)));
+ DoubleArray volArray = DoubleArray.copyOf(volList);
+ if (capFloorData.getDataType().equals(NORMAL_VOLATILITY)) { // correct initial surface
+ metadata = Surfaces.blackVolatilityByExpiryStrike(bsDefinition.getName().getName(), bsDefinition.getDayCount())

This comment has been minimized.

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

If says 'NORMAL_VOLATILITY' but metadata is 'blackVolatility'? Calibrate only Black surfaces?

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

If says 'NORMAL_VOLATILITY' but metadata is 'blackVolatility'? Calibrate only Black surfaces?

This comment has been minimized.

@yukiiwashita

yukiiwashita Dec 15, 2016

Member

Added javadoc on input vol types and output vol types.

@yukiiwashita

yukiiwashita Dec 15, 2016

Member

Added javadoc on input vol types and output vol types.

+ * The beta will be treated as one of the calibration parameters if this field is not specified.
+ */
+ @PropertyDefinition(get = "optional")
+ private final Curve betaCurve;

This comment has been minimized.

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

What about other curves? Beta and rho are usually not calibrated at the same time.

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

What about other curves? Beta and rho are usually not calibrated at the same time.

+ int[] startIndex = new int[nExpiries + 1];
+ for (int i = 0; i < nExpiries; ++i) {
+ LocalDate endDate = baseDate.plus(expiries.get(i));
+ DoubleArray volatilityData = capFloorData.getData().row(i);

This comment has been minimized.

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

Where is the difference between Normal and Black dealt with?

@marc-henrard

marc-henrard Dec 14, 2016

Contributor

Where is the difference between Normal and Black dealt with?

This comment has been minimized.

@yukiiwashita

yukiiwashita Dec 14, 2016

Member

The vol type difference is handled in volatilitiesFunction created by volatilitiesFunction.

@yukiiwashita

yukiiwashita Dec 14, 2016

Member

The vol type difference is handled in volatilitiesFunction created by volatilitiesFunction.

yukiiwashita added some commits Dec 14, 2016

fix
@marc-henrard

A couple of javadoc comments.

+ * The result is an interpolated surface spanned by expiry and strike.
+ * The position of the node points on the resultant surface corresponds to last expiry date of market caps.
+ * The nodes should be interpolated by a local interpolation scheme along the time direction.
+ * See {@link SurfaceIborCapletFloorletBootstrapDefinition} for detail.

This comment has been minimized.

@marc-henrard

marc-henrard Dec 19, 2016

Contributor

The name of this class has changed: 'SurfaceIborCapletFloorletVolatilityBootstrapDefinition'

@marc-henrard

marc-henrard Dec 19, 2016

Contributor

The name of this class has changed: 'SurfaceIborCapletFloorletVolatilityBootstrapDefinition'

+ * <p>
+ * If the shift curve is not present in {@code SurfaceIborCapletFloorletBootstrapVolatilityDefinition},
+ * the resultant volatility type is the same as the input volatility type, i.e.,
+ * Black caplet volatilities are returned if Balck cap volatilities are plugged in, and normal caplet volatilities are

This comment has been minimized.

@marc-henrard

marc-henrard Dec 19, 2016

Contributor

Spelling: Balck

@marc-henrard

marc-henrard Dec 19, 2016

Contributor

Spelling: Balck

+ * The result is a complete set of curves for the SABR parameters spanned by the expiry time.
+ * The position of the node points on the resultant curves corresponds to market cap expiries,
+ * and are interpolated by a local interpolation scheme.
+ * See {@link SabrIborCapletFloorletBootstrapDefinition} for detail.

This comment has been minimized.

@marc-henrard

marc-henrard Dec 19, 2016

Contributor

Name has changed to 'SabrIborCapletFloorletVolatilityBootstrapDefinition'

@marc-henrard

marc-henrard Dec 19, 2016

Contributor

Name has changed to 'SabrIborCapletFloorletVolatilityBootstrapDefinition'

yukiiwashita added some commits Dec 19, 2016

@yukiiwashita yukiiwashita merged commit b777c40 into master Dec 19, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@yukiiwashita yukiiwashita deleted the topic/caplet-stripping-bootstrap branch Dec 19, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment