java.lang.Object
net.finmath.marketdata.calibration.CalibratedCurves
Generate a collection of calibrated curves (discount curves, forward curves)
from a vector of calibration products.
An object of this class provides a calibration of curves (using multi-curves, forward curve, discount curve).
Sometimes this is referred as curve bootstrapping, however the algorithm used here is not a bootstrap.
The calibration products have to be provided via a vector of
For a demo spreadsheet using this class see finmath.net/topics/curvecalibration/.
CalibrationSpec
s.
The products provides are
Value of Type String | Classes | Note |
swap | Swap |
|
swapleg | SwapLeg |
Only the receiver part of CalibrationSpec is used. |
swapwithresetonreceiver | SwapLeg |
|
swapwithresetonpayer | SwapLeg |
|
deposit | Deposit |
Only the receiver part of CalibrationSpec is used. |
fra | ForwardRateAgreement |
Only the receiver part of CalibrationSpec is used. |
- Version:
- 1.0
- Author:
- Christian Fries
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Specification of calibration product. -
Constructor Summary
ConstructorsConstructorDescriptionCalibratedCurves(Collection<CalibratedCurves.CalibrationSpec> calibrationSpecs)
Generate a collection of calibrated curves (discount curves, forward curves) from a vector of calibration products.CalibratedCurves(List<CalibratedCurves.CalibrationSpec> calibrationSpecs, AnalyticModel calibrationModel, double evaluationTime, double calibrationAccuracy)
Generate a collection of calibrated curves (discount curves, forward curves) from a vector of calibration products and a given model.CalibratedCurves(CalibratedCurves.CalibrationSpec[] calibrationSpecs)
Generate a collection of calibrated curves (discount curves, forward curves) from a vector of calibration products.CalibratedCurves(CalibratedCurves.CalibrationSpec[] calibrationSpecs, AnalyticModelFromCurvesAndVols calibrationModel)
Generate a collection of calibrated curves (discount curves, forward curves) from a vector of calibration products and a given model.CalibratedCurves(CalibratedCurves.CalibrationSpec[] calibrationSpecs, AnalyticModelFromCurvesAndVols calibrationModel, double calibrationAccuracy)
Generate a collection of calibrated curves (discount curves, forward curves) from a vector of calibration products and a given model.CalibratedCurves(CalibratedCurves.CalibrationSpec[] calibrationSpecs, AnalyticModelFromCurvesAndVols calibrationModel, double evaluationTime, double calibrationAccuracy)
Generate a collection of calibrated curves (discount curves, forward curves) from a vector of calibration products and a given model. -
Method Summary
Modifier and TypeMethodDescriptiongetCalibrationProductForSpec(CalibratedCurves.CalibrationSpec calibrationSpec)
getCalibrationProductForSymbol(String symbol)
Returns the first product found in the vector of calibration products which matches the given symbol, where symbol is the String set in the calibrationSpecs.getCloneShifted(String symbol, double shift)
Returns the set curves calibrated to "shifted" market data, that is, the market date ofthis
object, modified by the shifts provided to this methods.getCloneShifted(Map<String,Double> shifts)
Returns the set curves calibrated to "shifted" market data, that is, the market date ofthis
object, modified by the shifts provided to this methods.getCloneShifted(Pattern symbolRegExp, double shift)
Returns the set curves calibrated to "shifted" market data, that is, the market date ofthis
object, modified by the shifts provided to this methods.getCloneShiftedForRegExp(String symbolRegExp, double shift)
Returns the set curves calibrated to "shifted" market data, that is, the market date ofthis
object, modified by the shifts provided to this methods.Get a curve for a given name.double
Return the accuracy achieved in the last calibration.int
Return the number of iterations needed to calibrate the model.getModel()
Return the calibrated model, i.e., the model maintaining a collection of curves calibrated to the given calibration specifications.
-
Constructor Details
-
CalibratedCurves
public CalibratedCurves(List<CalibratedCurves.CalibrationSpec> calibrationSpecs, AnalyticModel calibrationModel, double evaluationTime, double calibrationAccuracy) throws SolverException, CloneNotSupportedExceptionGenerate a collection of calibrated curves (discount curves, forward curves) from a vector of calibration products and a given model. If the model already contains a curve referenced as calibration curve that curve is replaced by a clone, retaining the given curve information and adding a new calibration point. If the model does not contain the curve referenced as calibration curve, the curve will be added to the model. Use case: You already have a discount curve as part of the model and like to calibrate an additional curve to an additional set of instruments.- Parameters:
calibrationSpecs
- Array of calibration specs.calibrationModel
- A given model used to value the calibration products.evaluationTime
- Evaluation time applied to the calibration products.calibrationAccuracy
- Error tolerance of the solver. Set to 0 if you need machine precision.- Throws:
SolverException
- May be thrown if the solver does not cannot find a solution of the calibration problem.CloneNotSupportedException
- Thrown, when a curve could not be cloned.
-
CalibratedCurves
public CalibratedCurves(CalibratedCurves.CalibrationSpec[] calibrationSpecs, AnalyticModelFromCurvesAndVols calibrationModel, double evaluationTime, double calibrationAccuracy) throws SolverException, CloneNotSupportedExceptionGenerate a collection of calibrated curves (discount curves, forward curves) from a vector of calibration products and a given model. If the model already contains a curve referenced as calibration curve that curve is replaced by a clone, retaining the given curve information and adding a new calibration point. If the model does not contain the curve referenced as calibration curve, the curve will be added to the model. Use case: You already have a discount curve as part of the model and like to calibrate an additional curve to an additional set of instruments.- Parameters:
calibrationSpecs
- Array of calibration specs.calibrationModel
- A given model used to value the calibration products.evaluationTime
- Evaluation time applied to the calibration products.calibrationAccuracy
- Error tolerance of the solver. Set to 0 if you need machine precision.- Throws:
SolverException
- May be thrown if the solver does not cannot find a solution of the calibration problem.CloneNotSupportedException
- Thrown, when a curve could not be cloned.
-
CalibratedCurves
public CalibratedCurves(CalibratedCurves.CalibrationSpec[] calibrationSpecs, AnalyticModelFromCurvesAndVols calibrationModel, double calibrationAccuracy) throws SolverException, CloneNotSupportedExceptionGenerate a collection of calibrated curves (discount curves, forward curves) from a vector of calibration products and a given model. If the model already contains a curve referenced as calibration curve that curve is replaced by a clone, retaining the given curve information and adding a new calibration point. If the model does not contain the curve referenced as calibration curve, the curve will be added to the model. Use case: You already have a discount curve as part of the model and like to calibrate an additional curve to an additional set of instruments.- Parameters:
calibrationSpecs
- Array of calibration specs.calibrationModel
- A given model used to value the calibration products.calibrationAccuracy
- Error tolerance of the solver. Set to 0 if you need machine precision.- Throws:
SolverException
- May be thrown if the solver does not cannot find a solution of the calibration problem.CloneNotSupportedException
- Thrown, when a curve could not be cloned.
-
CalibratedCurves
public CalibratedCurves(CalibratedCurves.CalibrationSpec[] calibrationSpecs, AnalyticModelFromCurvesAndVols calibrationModel) throws SolverException, CloneNotSupportedExceptionGenerate a collection of calibrated curves (discount curves, forward curves) from a vector of calibration products and a given model. If the model already contains a curve referenced as calibration curve that curve is replaced by a clone, retaining the given curve information and adding a new calibration point. If the model does not contain the curve referenced as calibration curve, the curve will be added to the model. Use case: You already have a discount curve as part of the model and like to calibrate an additional curve to an additional set of instruments.- Parameters:
calibrationSpecs
- Array of calibration specs.calibrationModel
- A given model used to value the calibration products.- Throws:
SolverException
- May be thrown if the solver does not cannot find a solution of the calibration problem.CloneNotSupportedException
- Thrown, when a curve could not be cloned.
-
CalibratedCurves
public CalibratedCurves(Collection<CalibratedCurves.CalibrationSpec> calibrationSpecs) throws SolverException, CloneNotSupportedExceptionGenerate a collection of calibrated curves (discount curves, forward curves) from a vector of calibration products.- Parameters:
calibrationSpecs
- Array of calibration specs.- Throws:
SolverException
- May be thrown if the solver does not cannot find a solution of the calibration problem.CloneNotSupportedException
- Thrown, when a curve could not be cloned.
-
CalibratedCurves
public CalibratedCurves(CalibratedCurves.CalibrationSpec[] calibrationSpecs) throws SolverException, CloneNotSupportedExceptionGenerate a collection of calibrated curves (discount curves, forward curves) from a vector of calibration products.- Parameters:
calibrationSpecs
- Array of calibration specs.- Throws:
SolverException
- May be thrown if the solver does not cannot find a solution of the calibration problem.CloneNotSupportedException
- Thrown, when a curve could not be cloned.
-
-
Method Details
-
getCalibrationProductForSpec
public AnalyticProduct getCalibrationProductForSpec(CalibratedCurves.CalibrationSpec calibrationSpec) -
getModel
Return the calibrated model, i.e., the model maintaining a collection of curves calibrated to the given calibration specifications.- Returns:
- The calibrated model.
-
getCurve
Get a curve for a given name.- Parameters:
name
- Name of the curve- Returns:
- The curve model.
-
getLastNumberOfInterations
public int getLastNumberOfInterations()Return the number of iterations needed to calibrate the model.- Returns:
- The number of iterations needed to calibrate the model.
-
getCloneShifted
public CalibratedCurves getCloneShifted(String symbol, double shift) throws SolverException, CloneNotSupportedExceptionReturns the set curves calibrated to "shifted" market data, that is, the market date ofthis
object, modified by the shifts provided to this methods.- Parameters:
symbol
- The symbol to shift. All other symbols remain unshifted.shift
- The shift to apply to the symbol.- Returns:
- A new set of calibrated curves, calibrated to shifted market data.
- Throws:
SolverException
- The likely cause of this exception is a failure of the solver used in the calibration.CloneNotSupportedException
- The likely cause of this exception is the inability to clone or modify a curve.
-
getCloneShifted
public CalibratedCurves getCloneShifted(Map<String,Double> shifts) throws SolverException, CloneNotSupportedExceptionReturns the set curves calibrated to "shifted" market data, that is, the market date ofthis
object, modified by the shifts provided to this methods.- Parameters:
shifts
- A map of shifts associating each symbol with a shifts. If symbols are not part of this map, they remain unshifted.- Returns:
- A new set of calibrated curves, calibrated to shifted market data.
- Throws:
SolverException
- The likely cause of this exception is a failure of the solver used in the calibration.CloneNotSupportedException
- The likely cause of this exception is the inability to clone or modify a curve.
-
getCloneShifted
public CalibratedCurves getCloneShifted(Pattern symbolRegExp, double shift) throws SolverException, CloneNotSupportedExceptionReturns the set curves calibrated to "shifted" market data, that is, the market date ofthis
object, modified by the shifts provided to this methods. This method will shift all symbols matching a given regular expressionPattern
.- Parameters:
symbolRegExp
- A pattern, identifying the symbols to shift.shift
- The shift to apply to the symbol(s).- Returns:
- A new set of calibrated curves, calibrated to shifted market data.
- Throws:
SolverException
- The likely cause of this exception is a failure of the solver used in the calibration.CloneNotSupportedException
- The likely cause of this exception is the inability to clone or modify a curve.- See Also:
Pattern
-
getCloneShiftedForRegExp
public CalibratedCurves getCloneShiftedForRegExp(String symbolRegExp, double shift) throws SolverException, CloneNotSupportedExceptionReturns the set curves calibrated to "shifted" market data, that is, the market date ofthis
object, modified by the shifts provided to this methods. This method will shift all symbols matching a given regular expression.- Parameters:
symbolRegExp
- A string representing a regular expression, identifying the symbols to shift.shift
- The shift to apply to the symbol(s).- Returns:
- A new set of calibrated curves, calibrated to shifted market data.
- Throws:
SolverException
- The likely cause of this exception is a failure of the solver used in the calibration.CloneNotSupportedException
- The likely cause of this exception is the inability to clone or modify a curve.- See Also:
Pattern
-
getLastAccuracy
public double getLastAccuracy()Return the accuracy achieved in the last calibration.- Returns:
- The accuracy achieved in the last calibration.
-
getCalibrationProductForSymbol
Returns the first product found in the vector of calibration products which matches the given symbol, where symbol is the String set in the calibrationSpecs.- Parameters:
symbol
- A given symbol string.- Returns:
- The product associated with that symbol.
-