Examples of InterestRateFutureOptionMarginTransaction


Examples of com.opengamma.analytics.financial.interestrate.future.derivative.InterestRateFutureOptionMarginTransaction

  public void presentValueFromFuturePrice() {
    final YieldCurveBundle curves = TestsDataSetsSABR.createCurves1();
    final SABRInterestRateParameters sabrParameter = TestsDataSetsSABR.createSABR1();
    final SABRInterestRateDataBundle sabrBundle = new SABRInterestRateDataBundle(sabrParameter, curves);
    final double priceFuture = 0.9905;
    final InterestRateFutureOptionMarginTransaction transactionNoPremium = new InterestRateFutureOptionMarginTransaction(OPTION_EDU2, QUANTITY, TRADE_PRICE);
    final double pv = METHOD.presentValueFromFuturePrice(transactionNoPremium, sabrBundle, priceFuture).getAmount();
    final double priceSecurity = METHOD_SECURITY.optionPriceFromFuturePrice(OPTION_EDU2, sabrBundle, priceFuture);
    final double pvExpected = (priceSecurity - TRADE_PRICE) * QUANTITY * NOTIONAL * FUTURE_FACTOR;
    assertEquals("Future option: present value from future price", pvExpected, pv, 1.0E-2);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.future.derivative.InterestRateFutureOptionMarginTransaction

   * Test the present value from the future price.
   */
  public void presentValue() {
    final InterestRateFutureSecurityDiscountingMethod methodFuture = InterestRateFutureSecurityDiscountingMethod.getInstance();
    final double priceFuture = methodFuture.price(EDU2, CURVES_BUNDLE);
    final InterestRateFutureOptionMarginTransaction transactionNoPremium = new InterestRateFutureOptionMarginTransaction(OPTION_EDU2, QUANTITY, TRADE_PRICE);
    final double pvNoPremium = METHOD.presentValue(transactionNoPremium, SABR_BUNDLE).getAmount();
    final double pvNoPremiumExpected = METHOD.presentValueFromFuturePrice(transactionNoPremium, SABR_BUNDLE, priceFuture).getAmount();
    assertEquals("Future option: present value", pvNoPremiumExpected, pvNoPremium);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.future.derivative.InterestRateFutureOptionMarginTransaction

  @Test
  /**
   * Test the present value from the method and from the calculator.
   */
  public void presentValueMethodVsCalculator() {
    final InterestRateFutureOptionMarginTransaction transactionNoPremium = new InterestRateFutureOptionMarginTransaction(OPTION_EDU2, QUANTITY, 0.0);
    final double pvNoPremiumMethod = METHOD.presentValue(transactionNoPremium, SABR_BUNDLE).getAmount();
    final double pvNoPremiumCalculator = transactionNoPremium.accept(PVC, SABR_BUNDLE);
    assertEquals("Future option: present value: Method vs Calculator", pvNoPremiumMethod, pvNoPremiumCalculator);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.future.derivative.InterestRateFutureOptionMarginTransaction

    //Testing note: Sensitivity is for a movement of 1. 1E+2 = 1 cent for a 1 bp move. Tolerance increased to cope with numerical imprecision of finite difference.
    final double deltaShift = 1.0E-6;
    // 1. Forward curve sensitivity
    final String bumpedCurveName = "Bumped Curve";
    final String[] curvesBumpedForward = new String[] {DISCOUNTING_CURVE_NAME, bumpedCurveName };
    final InterestRateFutureOptionMarginTransaction transactionBumped = TRANSACTION_DEFINITION.toDerivative(REFERENCE_DATE, TRADE_PRICE, curvesBumpedForward);
    final double[] nodeTimesForward = new double[] {EDU2.getFixingPeriodStartTime(), EDU2.getFixingPeriodEndTime() };
    final double[] sensiForwardMethod = SensitivityFiniteDifference.curveSensitivity(transactionBumped, SABR_BUNDLE, FORWARD_CURVE_NAME, bumpedCurveName, nodeTimesForward, deltaShift, METHOD);
    assertEquals("Sensitivity finite difference method: number of node", 2, sensiForwardMethod.length);
    final List<DoublesPair> sensiPvForward = pvsFuture.getSensitivities().get(FORWARD_CURVE_NAME);
    for (int loopnode = 0; loopnode < sensiForwardMethod.length; loopnode++) {
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.future.derivative.InterestRateFutureOptionMarginTransaction

    ValueProperties properties = spec.getProperties().copy().withoutAny(ValuePropertyNames.SCALE).with(ValuePropertyNames.SCALE, scaleProperty).get();
    ValueSpecification specWithScale = new ValueSpecification(spec.getValueName(), spec.getTargetSpecification(), properties)
   
    Double valueGamma = null;
    if (derivative instanceof InterestRateFutureOptionMarginTransaction) {
      final InterestRateFutureOptionMarginTransaction  transaction = (InterestRateFutureOptionMarginTransaction) derivative;
      final double gamma = TRANSANCTION_METHOD.presentValueGamma(transaction, data);
      final double spot = SECURITY_METHOD.underlyingFuturePrice(transaction.getUnderlyingOption(), data);
      valueGamma = 0.5 * spot * spot * gamma * scaleFactor * scaleFactor;
    } else {
      s_logger.error("Unexpected security type! {}. Examine converter", derivative.getClass());
    }
    return Collections.singleton(new ComputedValue(specWithScale, valueGamma));
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.