I used the SwapPricingWithCalibrationExample source, removed the fixing part, and replaced FixedIborSwapConventions.USD_FIXED_6M_LIBOR_3M
with my own definition of CAD_FIXED_6M_CDOR_3M
and got pretty close to the expected result seen in a vendor terminal.
SwapTradeCalculations does wonders
Here’s my shortest way to calculate this:
ReferenceData REF_DATA = ReferenceData.standard();
Map<CurveGroupName, CurveGroupDefinition> defns =
RatesCalibrationCsvLoader.load(
GROUPS_RESOURCE,
SETTINGS_RESOURCE,
CALIBRATION_RESOURCE);
ResolvedSwapTrade swap =
CAD_FIXED_6M_CDOR_3M.createTrade(
VALUATION_DATE,
SWAP_PERIOD_TO_START,
Tenor.of(Period.ofYears(3)),
BuySell.BUY,
SWAP_NOTIONAL,
SWAP_COUPON,
REF_DATA)
.resolve(REF_DATA);
CalibrationMeasures CALIBRATION_MEASURES = CalibrationMeasures.PAR_SPREAD;
CurveCalibrator CALIBRATOR = CurveCalibrator.of(1e-9, 1e-9, 100, CALIBRATION_MEASURES);
ImmutableMap<QuoteId, Double> MAP_MQ = QuotesCsvLoader.load(VALUATION_DATE, QUOTES_RESOURCE);
ImmutableMarketData MARKET_QUOTES = ImmutableMarketData.builder(VALUATION_DATE).values(MAP_MQ).build();
ImmutableRatesProvider multicurve = CALIBRATOR.calibrate(defns.get(CURVE_GROUP_NAME), MARKET_QUOTES,REF_DATA);
DiscountingSwapTradePricer PRICER_SWAP = DiscountingSwapTradePricer.DEFAULT;
SwapTradeCalculations swapTradeCalc = new SwapTradeCalculations(PRICER_SWAP);
System.out.println("DV01 = "+swapTradeCalc.pv01MarketQuoteSum(swap, multicurve));
CalibrationMeasures.PAR_SPREAD
is the only type that works for me.
If I use MARKET_QUOTE
I get a yData containing NaN
exception
If I use PRESENT_VALUE
I get Market Quote sensitivity requires Jacobian calibration information
exception.
Also If I define in my calibration file the 1M and 2M CDOR values, I get a BaseNewtonVectorRootFinder - Failed to converge in backtracking, even after a Jacobian recalculation
exception.
files below
groups
Group Name,Curve Type,Reference,Curve Name
IRS-VS-3M-CDOR,Discount,CAD,CAD-CURVE
IRS-VS-3M-CDOR,Forward,CAD-CDOR-3M,CAD-CURVE
settings
Curve Name,Value Type,Day Count,Interpolator,Left Extrapolator,Right Extrapolator
CAD-CURVE,Zero,Act/365F,LogNaturalSplineDiscountFactor,Interpolator,LogLinear
calibrations
Curve Name,Label,Symbology,Ticker,Field Name,Type,Convention,Time,Date
#CAD-CURVE,CAD-CDOR-1M,OG-Ticker,CAD-CDOR-1M,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,1M,
#CAD-CURVE,CAD-CDOR-2M,OG-Ticker,CAD-CDOR-2M,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,2M,
CAD-CURVE,CAD-CDOR-3M,OG-Ticker,CAD-CDOR-3M,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,3M,
CAD-CURVE,CAD-CDOR-6M,OG-Ticker,CAD-CDOR-6M,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,6M,
CAD-CURVE,CAD-CDOR-1Y,OG-Ticker,CAD-CDOR-1Y,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,1Y,
CAD-CURVE,DLR-CMP-2Y,OG-Ticker,DLR-CMP-2Y,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,2Y,
CAD-CURVE,DLR-CMP-3Y,OG-Ticker,DLR-CMP-3Y,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,3Y,
CAD-CURVE,DLR-CMP-4Y,OG-Ticker,DLR-CMP-4Y,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,4Y,
CAD-CURVE,DLR-CMP-5Y,OG-Ticker,DLR-CMP-5Y,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,5Y,
CAD-CURVE,DLR-CMP-6Y,OG-Ticker,DLR-CMP-6Y,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,6Y,
CAD-CURVE,DLR-CMP-7Y,OG-Ticker,DLR-CMP-7Y,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,7Y,
CAD-CURVE,DLR-CMP-8Y,OG-Ticker,DLR-CMP-8Y,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,8Y,
CAD-CURVE,DLR-CMP-9Y,OG-Ticker,DLR-CMP-9Y,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,9Y,
CAD-CURVE,DLR-CMP-10Y,OG-Ticker,DLR-CMP-10Y,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,10Y,
CAD-CURVE,DLR-CMP-12Y,OG-Ticker,DLR-CMP-12Y,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,12Y,
CAD-CURVE,DLR-CMP-15Y,OG-Ticker,DLR-CMP-15Y,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,15Y,
CAD-CURVE,DLR-CMP-20Y,OG-Ticker,DLR-CMP-20Y,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,20Y,
CAD-CURVE,DLR-CMP-25Y,OG-Ticker,DLR-CMP-25Y,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,25Y,
CAD-CURVE,DLR-CMP-30Y,OG-Ticker,DLR-CMP-30Y,MarketValue,IRS,CAD-FIXED-6M-CDOR-3M,30Y,
quotes
Valuation Date,Symbology,Ticker,Field Name,Value
2018-03-19,OG-Ticker,CAD-CDOR-1M,MarketValue,0.01595
2018-03-19,OG-Ticker,CAD-CDOR-2M,MarketValue,0.0164
2018-03-19,OG-Ticker,CAD-CDOR-3M,MarketValue,0.016975
2018-03-19,OG-Ticker,CAD-CDOR-6M,MarketValue,0.0184875
2018-03-19,OG-Ticker,CAD-CDOR-1Y,MarketValue,0.0205625
2018-03-19,OG-Ticker,DLR-CMP-2Y,MarketValue,0.02148
2018-03-19,OG-Ticker,DLR-CMP-3Y,MarketValue,0.02280
2018-03-19,OG-Ticker,DLR-CMP-4Y,MarketValue,0.03366
2018-03-19,OG-Ticker,DLR-CMP-5Y,MarketValue,0.02419
2018-03-19,OG-Ticker,DLR-CMP-6Y,MarketValue,0.02458
2018-03-19,OG-Ticker,DLR-CMP-7Y,MarketValue,0.02496
2018-03-19,OG-Ticker,DLR-CMP-8Y,MarketValue,0.02533
2018-03-19,OG-Ticker,DLR-CMP-9Y,MarketValue,0.02569
2018-03-19,OG-Ticker,DLR-CMP-10Y,MarketValue,0.02601
2018-03-19,OG-Ticker,DLR-CMP-12Y,MarketValue,0.02654
2018-03-19,OG-Ticker,DLR-CMP-15Y,MarketValue,0.02713
2018-03-19,OG-Ticker,DLR-CMP-20Y,MarketValue,0.02764
2018-03-19,OG-Ticker,DLR-CMP-25Y,MarketValue,0.02755
2018-03-19,OG-Ticker,DLR-CMP-30Y,MarketValue,0.02733