Thanks for the great work for Strata.
I’m running the example SwapPricingWithCalibrationExample
for some validations.
The original setting is like:
Curve Name,Value Type,Day Count,Interpolator,Left Extrapolator,Right Extrapolator
USD-Disc,Zero,Act/365F,Linear,Flat,Flat
USD-3ML,Zero,Act/365F,Linear,Flat,Flat
I want to see the calibrated curve in the form with discount factors instead of zero rate and I assume changing the ‘Type’ from Zero to DF would suffice.
Curve Name,Value Type,Day Count,Interpolator,Left Extrapolator,Right Extrapolator
USD-Disc,DF,Act/365F,Linear,Flat,Flat
USD-3ML,DF,Act/365F,Linear,Flat,Flat
However, when I run the example with this updated setting, the program complains like:
[main] INFO com.opengamma.strata.math.impl.rootfinding.newton.BaseNewtonVectorRootFinder - Failed to converge in backtracking, even after a Jacobian recalculation.Final position:[0.9989421052247818, 0.9980665652046564, 0.9972072722570962, 0.9935189049487357]
last deltaX:[-2.3933814792120896E-9, -1.0027323018698439E-9, -8.948817368652821E-10, 4.3119719939604865E-9]
function value:[-0.01109, 1.6629957842878573E-6, 1.255129442271491E-7, 2.0052499361835306E-6]
Jacobian:
0.0 0.0 0.0 0.0
3.9206237486359328 -3.9240630613185297 0.0 0.0
0.0 3.8405127405199786 -3.843822108195842 0.0
1.0042250407892157 -0.002673249694639651 -0.03310632002601799 -0.9737919704578374
I changed several interpolators and none of them works.
Am I misunderstanding what the ‘Type’ really means?
Update:
I might find where the problem is. I debugged and found that the Flat Extrapolator would be the cause.
Say I have a 3m libor fixing deposit trade which starts at 2020/4/21, effective at 4/23 and mature at 7/23;
7/23 is the first node on curve; when getting the df on 4/23, extrapolator comes in, thus obtaining same df on 4/23 and 7/23 which then cause the disaster.
I changed to the Linear, however I got another Error:
Exception in thread “main” com.opengamma.strata.math.MathException: Cannot work with this starting >position. Please choose another point
yet another error again for LogLinear:
Exception in thread “main” java.lang.IllegalArgumentException: Argument ‘amount’ must not be NaN
at com.opengamma.strata.collect.ArgChecker.notNaN(ArgChecker.java:841)
at com.opengamma.strata.basics.currency.CurrencyAmount.(CurrencyAmount.java:148)
at com.opengamma.strata.basics.currency.CurrencyAmount.of(CurrencyAmount.java:86)
at com.opengamma.strata.pricer.swap.DiscountingSwapProductPricer.presentValue(DiscountingSwapProductPricer.java:96)
at com.opengamma.strata.pricer.swap.DiscountingSwapProductPricer.parSpread(DiscountingSwapProductPricer.java:308)
at com.opengamma.strata.pricer.curve.TradeCalibrationMeasure.lambda$static$4(TradeCalibrationMeasure.java:66)
at com.opengamma.strata.pricer.curve.TradeCalibrationMeasure.value(TradeCalibrationMeasure.java:164)
at com.opengamma.strata.pricer.curve.CalibrationMeasures.value(CalibrationMeasures.java:153)
at com.opengamma.strata.pricer.curve.CalibrationValue.lambda$apply$0(CalibrationValue.java:61)
at java.base/java.util.Arrays.setAll(Arrays.java:5414)
at com.opengamma.strata.collect.array.DoubleArray.of(DoubleArray.java:272)
at com.opengamma.strata.pricer.curve.CalibrationValue.apply(CalibrationValue.java:61)
at com.opengamma.strata.pricer.curve.CalibrationValue.apply(CalibrationValue.java:22)
at com.opengamma.strata.math.impl.rootfinding.newton.BaseNewtonVectorRootFinder.updatePosition(BaseNewtonVectorRootFinder.java:175)
at com.opengamma.strata.math.impl.rootfinding.newton.BaseNewtonVectorRootFinder.getNextPosition(BaseNewtonVectorRootFinder.java:147)
at com.opengamma.strata.math.impl.rootfinding.newton.BaseNewtonVectorRootFinder.findRoot(BaseNewtonVectorRootFinder.java:87)
at com.opengamma.strata.pricer.curve.RatesCurveCalibrator.calibrateGroup(RatesCurveCalibrator.java:320)
at com.opengamma.strata.pricer.curve.RatesCurveCalibrator.calibrate(RatesCurveCalibrator.java:277)
at com.opengamma.strata.pricer.curve.RatesCurveCalibrator.calibrate(RatesCurveCalibrator.java:226)
at
I wish someone could save me from here, thanks a lot.