Package com.opengamma.analytics.financial.provider.sensitivity.multicurve

Examples of com.opengamma.analytics.financial.provider.sensitivity.multicurve.MulticurveSensitivity.multipliedBy()


      final SABRFormulaData sabrParam = new SABRFormulaData(alpha, beta, rho, nu);
      final SABRExtrapolationRightFunction sabrExtrapolation = new SABRExtrapolationRightFunction(forward, sabrParam, _cutOffStrike, cap.getFixingTime(), _mu);
      bsPrice = sabrExtrapolation.price(option);
      bsDforward = sabrExtrapolation.priceDerivativeForward(option);
    }
    result = result.multipliedBy(bsPrice);
    result = result.plus(forwardDr.multipliedBy(bsDforward));
    result = result.multipliedBy(cap.getNotional() * cap.getPaymentYearFraction());
    return MultipleCurrencyMulticurveSensitivity.of(cap.getCurrency(), result);
  }

View Full Code Here


      bsPrice = sabrExtrapolation.price(option);
      bsDforward = sabrExtrapolation.priceDerivativeForward(option);
    }
    result = result.multipliedBy(bsPrice);
    result = result.plus(forwardDr.multipliedBy(bsDforward));
    result = result.multipliedBy(cap.getNotional() * cap.getPaymentYearFraction());
    return MultipleCurrencyMulticurveSensitivity.of(cap.getCurrency(), result);
  }

  /**
   * Computes the present value SABR sensitivity of a cap/floor in the SABR framework with extrapolation on the right.
View Full Code Here

    list.add(new DoublesPair(cmsCapFloor.getPaymentTime(), sensiDF));
    final Map<String, List<DoublesPair>> resultMapDsc = new HashMap<>();
    resultMapDsc.put(sabrData.getMulticurveProvider().getName(ccy), list);
    final MulticurveSensitivity dscDp = MulticurveSensitivity.ofYieldDiscounting(resultMapDsc);
    final MulticurveSensitivity forwardDp = cmsCapFloor.getUnderlyingSwap().accept(PRCSDC, sabrData.getMulticurveProvider());
    return MultipleCurrencyMulticurveSensitivity.of(ccy, dscDp.plus(forwardDp.multipliedBy(deltaS0)));
  }

  /**
   * Computes the present value sensitivity to the SABR parameters of a CMS cap/floor by replication in SABR framework.
   * @param cmsCapFloor The CMS cap/floor.
View Full Code Here

    final MulticurveSensitivity pvcs1 = pvcs.converted(ccy1, multicurves.getFxRates()).getSensitivity(ccy1);
    final MulticurveSensitivity pvmqscs = swap.getFirstLeg().accept(PVMQSCSMC, multicurves);
    final double pvmqs = swap.getFirstLeg().accept(PVMQSMC, multicurves);
    final double pv = multicurves.getFxRates().convert(swap.accept(PVMC, multicurves), ccy1).getAmount();
    // Implementation note: Total pv in currency 1.
    return pvcs1.multipliedBy(-1.0 / pvmqs).plus(pvmqscs.multipliedBy(pv / (pvmqs * pvmqs)));
  }

  @Override
  public MulticurveSensitivity visitFixedCouponSwap(final SwapFixedCoupon<?> swap, final MulticurveProviderInterface multicurve) {
    return visitSwap(swap, multicurve);
View Full Code Here

    final List<DoublesPair> list = new ArrayList<>();
    list.add(new DoublesPair(cmsSpread.getPaymentTime(), -cmsSpread.getPaymentTime() * discountFactorPayment));
    final Map<String, List<DoublesPair>> resultMap = new HashMap<>();
    resultMap.put(multicurves.getName(ccy), list);
    final MulticurveSensitivity dfCurveSensitivity = MulticurveSensitivity.ofYieldDiscounting(resultMap);
    MultipleCurrencyMulticurveSensitivity result = MultipleCurrencyMulticurveSensitivity.of(ccy, dfCurveSensitivity.multipliedBy(discountFactorPaymentBar));
    result = result.plus(cmsCoupon1CurveSensitivity.multipliedBy(cmsCoupon1PvBar));
    result = result.plus(cmsCoupon2CurveSensitivity.multipliedBy(cmsCoupon2PvBar));
    result = result.plus(cmsCap1CurveSensitivity.multipliedBy(cmsCap1PvBar));
    result = result.plus(cmsCap2CurveSensitivity.multipliedBy(cmsCap2PvBar));
    //Calibration strike dependency -- START
View Full Code Here

    final Map<String, List<DoublesPair>> sensi11 = new HashMap<>();
    sensi11.put(CURVE_NAME_1, SENSI_DATA_1);
    final Map<String, List<ForwardSensitivity>> sensiFwd11 = new HashMap<>();
    sensiFwd11.put(CURVE_NAME_2, SENSI_FWD_1);
    final MulticurveSensitivity pvSensiDscFwd = MulticurveSensitivity.of(sensi11, sensiFwd11);
    AssertSensivityObjects.assertEquals("CurveSensitivityMarket: plusMultipliedBy", pvSensiDscFwd.plus(pvSensiDscFwd).cleaned(), pvSensiDscFwd.multipliedBy(2.0).cleaned(), TOLERANCE);

    final List<ForwardSensitivity> sensiFwd2 = new ArrayList<>();
    sensiFwd2.add(new ForwardSensitivity(2.5, 2.75, 0.26, 11));
    final Map<String, List<DoublesPair>> sensi32 = new HashMap<>();
    sensi11.put(CURVE_NAME_3, SENSI_DATA_2);
View Full Code Here

    final Currency ccy2 = Currency.USD;
    final FXMatrix fxMatrix = new FXMatrix(ccy1, ccy2, 1.25);
    final MulticurveSensitivity cs = MulticurveSensitivity.of(SENSI_11, SENSI_FWD_11);
    final MultipleCurrencyMulticurveSensitivity mcs = MultipleCurrencyMulticurveSensitivity.of(ccy1, cs);
    final MultipleCurrencyMulticurveSensitivity mcsConverted = mcs.converted(ccy2, fxMatrix);
    final MultipleCurrencyMulticurveSensitivity mcsExpected = MultipleCurrencyMulticurveSensitivity.of(ccy2, cs.multipliedBy(fxMatrix.getFxRate(ccy1, ccy2)));
    AssertSensivityObjects.assertEquals("MultipleCurrencyCurveSensitivityMarket: converted", mcsExpected.cleaned(), mcsConverted.cleaned(), TOLERANCE);
  }

  @Test
  public void equalHash() {
View Full Code Here

   * Tests the present value curve sensitivity method for bond futures.
   */
  public void presentValueCurveSensitivityRelative() {
    final MultipleCurrencyMulticurveSensitivity pvcsComputed = METHOD_HW.presentValueCurveSensitivity(BOND_FUTURE_DERIV, HW_ISSUER);
    final MulticurveSensitivity pcsSecurity = METHOD_HW.priceCurveSensitivity(BOND_FUTURE_DERIV, HW_ISSUER);
    final MultipleCurrencyMulticurveSensitivity pvcsExpected = MultipleCurrencyMulticurveSensitivity.of(USD, pcsSecurity.multipliedBy(NOTIONAL));
    AssertSensivityObjects.assertEquals("Bond future transaction Discounting Method: present value curve sensitivity", pvcsExpected.cleaned(), pvcsComputed.cleaned(), TOLERANCE_PV_DELTA);
  }

}
View Full Code Here

        minPrice = (bondForwardPrice[loopbasket] - BASKET[loopbasket].getAccruedInterest()) / CONVERSION_FACTOR[loopbasket];
        minIndex = loopbasket;
      }
    }
    MulticurveSensitivity sensiBond = METHOD_BOND_SEC.dirtyPriceCurveSensitivity(BASKET[minIndex], ISSUER_MULTICURVES);
    sensiBond = sensiBond.multipliedBy(1.0 / CONVERSION_FACTOR[minIndex]);
    sensiFuture = sensiFuture.cleaned();
    sensiBond = sensiBond.cleaned();
    AssertSensivityObjects.assertEquals("BondFutureSecurityDiscountingMethod: priceCurveSensitivity", sensiBond, sensiFuture, TOLERANCE_PRICE_DELTA);
  }
View Full Code Here

    final MultipleCurrencyMulticurveSensitivity pvcsComputed = METHOD_SWAP_FUT_TRA_HW.presentValueCurveSensitivity(SWAP_FUTURES_TRANSACTION, MULTICURVES_HW);
    final MultipleCurrencyMulticurveSensitivity pvcsExpected1 = METHOD_SWAP_FUT_TRA_HW.presentValueCurveSensitivity(SWAP_FUTURES_TRANSACTION, pricecs);
    AssertSensivityObjects.assertEquals("DeliverableSwapFuturesTransactionHullWhiteMethod: present value curve sensitivity",
        pvcsExpected1, pvcsComputed, TOLERANCE_PV_DELTA);
    final MultipleCurrencyMulticurveSensitivity pvcsExpected2 =
        MultipleCurrencyMulticurveSensitivity.of(USD, pricecs.multipliedBy(SWAP_FUTURES_SECURITY_DEFINITION.getNotional() * QUANTITY));
    AssertSensivityObjects.assertEquals("DeliverableSwapFuturesTransactionHullWhiteMethod: present value curve sensitivity",
        pvcsExpected2, pvcsComputed, TOLERANCE_PV_DELTA);
  }

  @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.