@Test(enabled = false)
  /** Analyzes the shape of the forward curve. */
  public void marketQuoteSensitivityAnalysis() {

    final InflationProviderDiscount multicurves7 =
        CURVES_PAR_SPREAD_MQ_WITHOUT_TODAY_BLOCK.get(1).getFirst();
    multicurves7.setAll(CURVES_PAR_SPREAD_MQ_WITHOUT_TODAY_BLOCK.get(0).getFirst());
    final CurveBuildingBlockBundle blocks7 =
        CURVES_PAR_SPREAD_MQ_WITHOUT_TODAY_BLOCK.get(1).getSecond();
    blocks7.addAll(CURVES_PAR_SPREAD_MQ_WITHOUT_TODAY_BLOCK.get(0).getSecond());
    final double spreadJPYEUR = 0.0010; // 10bps
    final double notional = 100000;
    final GeneratorAttributeIR swapAttribute = new GeneratorAttributeIR(Period.ofYears(4));
    final SwapFixedInflationZeroCouponDefinition swapDefinition =
        GENERATOR_INFALTION_SWAP.generateInstrument(NOW, spreadJPYEUR, notional, swapAttribute);
    final InstrumentDerivative swap =
        swapDefinition.toDerivative(
            NOW,
            new ZonedDateTimeDoubleTimeSeries[] {
              TS_PRICE_INDEX_USD_WITH_TODAY, TS_PRICE_INDEX_USD_WITH_TODAY
            });
    final ParameterSensitivityInflationParameterCalculator<ParameterInflationProviderInterface>
        PSC = new ParameterSensitivityInflationParameterCalculator<>(PVCSDIC);
    final MarketQuoteInflationSensitivityBlockCalculator<ParameterInflationProviderInterface> MQSC =
        new MarketQuoteInflationSensitivityBlockCalculator<>(PSC);
    @SuppressWarnings("unused")
    final MultipleCurrencyParameterSensitivity mqs =
        MQSC.fromInstrument(swap, multicurves7, blocks7);
  }
 /** Tests the present value computation. */
 public void presentValueTips1() {
   final InflationProviderDiscount marketUSGovt = new InflationProviderDiscount();
   marketUSGovt.setCurve(
       BOND_SECURITY_TIPS_1.getCurrency(),
       MARKET.getCurve(BOND_SECURITY_TIPS_1.getIssuerEntity()));
   marketUSGovt.setCurve(PRICE_INDEX_USCPI, MARKET.getCurve(PRICE_INDEX_USCPI));
   final MultiCurrencyAmount pvNominal =
       METHOD_INFLATION_ZC_INTERPOLATION.presentValue(
           (CouponInflationZeroCouponInterpolationGearing)
               BOND_SECURITY_TIPS_1.getNominal().getNthPayment(0),
           marketUSGovt);
   MultiCurrencyAmount pvCoupon = MultiCurrencyAmount.of(BOND_SECURITY_TIPS_1.getCurrency(), 0.0);
   for (int loopcpn = 0;
       loopcpn < BOND_SECURITY_TIPS_1.getCoupon().getNumberOfPayments();
       loopcpn++) {
     pvCoupon =
         pvCoupon.plus(
             BOND_SECURITY_TIPS_1.getCoupon().getNthPayment(loopcpn).accept(PVDIC, marketUSGovt));
   }
   final MultiCurrencyAmount pvExpected = pvNominal.plus(pvCoupon);
   final MultiCurrencyAmount pv = METHOD_BOND_INFLATION.presentValue(BOND_SECURITY_TIPS_1, MARKET);
   assertEquals(
       "Inflation Capital Indexed bond: present value",
       pvExpected.getAmount(BOND_SECURITY_TIPS_1.getCurrency()).getAmount(),
       pv.getAmount(BOND_SECURITY_TIPS_1.getCurrency()).getAmount(),
       1.0E-2);
 }
コード例 #3
0
 @Override
 protected void buildMessage(
     final FudgeSerializer serializer,
     final MutableFudgeMsg message,
     final InflationProviderDiscount object) {
   serializer.addToMessageWithClassHeaders(
       message, YIELD_CURVES_FIELD, null, object.getMulticurveProvider());
   final Map<IndexPrice, PriceIndexCurve> priceIndexCurves = object.getPriceIndexCurves();
   for (final Map.Entry<IndexPrice, PriceIndexCurve> entry : priceIndexCurves.entrySet()) {
     serializer.addToMessageWithClassHeaders(message, PRICE_INDEX_FIELD, null, entry.getKey());
     serializer.addToMessageWithClassHeaders(
         message, PRICE_INDEX_CURVE_FIELD, null, entry.getValue());
   }
 }
コード例 #4
0
 public void curveConstructionTest(
     final InstrumentDefinition<?>[][][] definitions,
     final InflationProviderDiscount curves,
     final boolean withToday,
     final int block) {
   final int nbBlocks = definitions.length;
   for (int loopblock = 0; loopblock < nbBlocks; loopblock++) {
     final InstrumentDerivative[][] instruments =
         convert(definitions[loopblock], loopblock, withToday);
     final double[][] pv = new double[instruments.length][];
     for (int loopcurve = 0; loopcurve < instruments.length; loopcurve++) {
       pv[loopcurve] = new double[instruments[loopcurve].length];
       for (int loopins = 0; loopins < instruments[loopcurve].length; loopins++) {
         pv[loopcurve][loopins] =
             curves
                 .getFxRates()
                 .convert(instruments[loopcurve][loopins].accept(PVIC, curves), EUR)
                 .getAmount();
         assertEquals(
             "Curve construction: block "
                 + block
                 + ", unit "
                 + loopblock
                 + " - instrument "
                 + loopins,
             0,
             pv[loopcurve][loopins],
             TOLERANCE_CAL);
       }
     }
   }
 }