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

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


  @Test
  public void presentValueCurveSensitivityFromCurves() {
    final MultipleCurrencyMulticurveSensitivity pvcsCallComputed = METHOD_BLACK_TRA.presentValueCurveSensitivity(BOND_FUTURE_OPTION_TRA_CALL, BLACK_MULTICURVES).cleaned();
    final MulticurveSensitivity pcsCall = METHOD_BLACK_SEC.priceCurveSensitivity(BOND_FUTURE_OPTION_SEC_CALL, BLACK_MULTICURVES);
    final MultipleCurrencyMulticurveSensitivity pvcsCallPremium = METHOD_PAY_FIXED.presentValueCurveSensitivity(BOND_FUTURE_OPTION_TRA_CALL.getPremium(), ISSUER_MULTICURVES.getMulticurveProvider());
    final MultipleCurrencyMulticurveSensitivity pvcsCallExpected = pvcsCallPremium.plus(MultipleCurrencyMulticurveSensitivity.of(USD, pcsCall.multipliedBy(NOTIONAL * QUANTITY))).cleaned();
    AssertSensivityObjects.assertEquals("BondFutureOptionPremiumTransactionBlackSurfaceMethod: present value curve sensitivity", pvcsCallExpected, pvcsCallComputed, TOLERANCE_PV_SENSI);
    final MultipleCurrencyMulticurveSensitivity pvcsPutComputed = METHOD_BLACK_TRA.presentValueCurveSensitivity(BOND_FUTURE_OPTION_TRA_PUT, BLACK_MULTICURVES).cleaned();
    final MultipleCurrencyMulticurveSensitivity pvcsPutPremium = METHOD_PAY_FIXED.presentValueCurveSensitivity(BOND_FUTURE_OPTION_TRA_PUT.getPremium(), ISSUER_MULTICURVES.getMulticurveProvider());
    final MultipleCurrencyMulticurveSensitivity pvcsFutQu = METHOD_FUTURES.presentValueCurveSensitivity(BOND_FUT, ISSUER_MULTICURVES).multipliedBy(QUANTITY).cleaned(TOLERANCE_PV_SENSI);
    final MultipleCurrencyMulticurveSensitivity pvcsCallPut = pvcsCallComputed.plus(pvcsCallPremium.multipliedBy(-1)).plus(pvcsPutPremium.plus(pvcsPutComputed.multipliedBy(-1)))
View Full Code Here


  @Test
  public void presentValueCurveSensitivityFromFuturesPrice() {
    final MultipleCurrencyMulticurveSensitivity pvcsCallComputed = METHOD_BLACK_TRA.presentValueCurveSensitivity(BOND_FUTURE_OPTION_TRA_CALL, BLACK_PRICE_MULTICURVES).cleaned();
    final MulticurveSensitivity pcsCall = METHOD_BLACK_SEC.priceCurveSensitivity(BOND_FUTURE_OPTION_SEC_CALL, BLACK_PRICE_MULTICURVES);
    final MultipleCurrencyMulticurveSensitivity pvcsCallPremium = METHOD_PAY_FIXED.presentValueCurveSensitivity(BOND_FUTURE_OPTION_TRA_CALL.getPremium(), ISSUER_MULTICURVES.getMulticurveProvider());
    final MultipleCurrencyMulticurveSensitivity pvcsCallExpected = pvcsCallPremium.plus(MultipleCurrencyMulticurveSensitivity.of(USD, pcsCall.multipliedBy(NOTIONAL * QUANTITY))).cleaned();
    AssertSensivityObjects.assertEquals("BondFutureOptionPremiumTransactionBlackSurfaceMethod: present value curve sensitivity", pvcsCallExpected, pvcsCallComputed, TOLERANCE_PV_SENSI);
    final MultipleCurrencyMulticurveSensitivity pvcsPutComputed = METHOD_BLACK_TRA.presentValueCurveSensitivity(BOND_FUTURE_OPTION_TRA_PUT, BLACK_PRICE_MULTICURVES).cleaned();
    final MultipleCurrencyMulticurveSensitivity pvcsPutPremium = METHOD_PAY_FIXED.presentValueCurveSensitivity(BOND_FUTURE_OPTION_TRA_PUT.getPremium(), ISSUER_MULTICURVES.getMulticurveProvider());
    final MultipleCurrencyMulticurveSensitivity pvcsFutQu = METHOD_FUTURES.presentValueCurveSensitivity(BOND_FUT, ISSUER_MULTICURVES).multipliedBy(QUANTITY).cleaned(TOLERANCE_PV_SENSI);
    final MultipleCurrencyMulticurveSensitivity pvcsCallPut = pvcsCallComputed.plus(pvcsCallPremium.multipliedBy(-1)).plus(pvcsPutPremium.plus(pvcsPutComputed.multipliedBy(-1)))
View Full Code Here

   * Tests the present value curve sensitivity method for bond futures.
   */
  public void presentValueCurveSensitivityVsPrice() {
    final MultipleCurrencyMulticurveSensitivity pvcsComputed = METHOD_FUT_TRA_DSC.presentValueCurveSensitivity(BOND_FUTURES_TRA, ISSUER_MULTICURVES).cleaned();
    final MulticurveSensitivity pcs = METHOD_FUT_SEC_DSC.priceCurveSensitivity(BOND_FUTURES_SEC, ISSUER_MULTICURVES);
    final MultipleCurrencyMulticurveSensitivity pvcsExpected = MultipleCurrencyMulticurveSensitivity.of(USD, pcs.multipliedBy(NOTIONAL * QUANTITY).cleaned());
    AssertSensivityObjects.assertEquals("Bond future Discounting Method: pv curve sensitivity", pvcsComputed, pvcsExpected, TOLERANCE_PV_DELTA);
  }

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

        minPrice = (bondForwardPrice[loopbasket] - BASKET[loopbasket].getAccruedInterest()) / CONVERSION_FACTOR[loopbasket];
        minIndex = loopbasket;
      }
    }
    MulticurveSensitivity sensiBond = METHOD_BOND.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

   * Tests the present value  curve sensitivity method for bond futures.
   */
  public void presentValueCurveSensitivity() {
    final MultipleCurrencyMulticurveSensitivity pvcsComputed = METHOD_FUT_DSC.presentValueCurveSensitivity(BOND_FUTURE, ISSUER_MULTICURVES).cleaned();
    final MulticurveSensitivity pcs = METHOD_FUT_DSC.priceCurveSensitivity(BOND_FUTURE, ISSUER_MULTICURVES);
    final MultipleCurrencyMulticurveSensitivity pvcsExpected = MultipleCurrencyMulticurveSensitivity.of(USD, pcs.multipliedBy(NOTIONAL).cleaned());
    AssertSensivityObjects.assertEquals("Bond future Discounting Method: pv curve sensitivity", pvcsComputed, pvcsExpected, TOLERANCE_PV_DELTA);
  }

}
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.