Package com.opengamma.analytics.financial.interestrate

Examples of com.opengamma.analytics.financial.interestrate.InterestRateCurveSensitivity.multipliedBy()


  public InterestRateCurveSensitivity presentValueCurveSensitivity(final BondFutureOptionPremiumTransaction transaction, final YieldCurveBundle curves) {
    ArgumentChecker.notNull(transaction, "transaction");
    ArgumentChecker.notNull(curves, "curves");
    final InterestRateCurveSensitivity premiumSensitivity = PVCSC.visit(transaction.getPremium(), curves);
    final InterestRateCurveSensitivity securitySensitivity = METHOD_SECURITY.priceCurveSensitivity(transaction.getUnderlyingOption(), curves);
    return premiumSensitivity.plus(securitySensitivity.multipliedBy(transaction.getQuantity() * transaction.getUnderlyingOption().getUnderlyingFuture().getNotional()));
  }

  /**
   * Computes the present value gamma of a transaction.
   * This is with respect to futures rate
View Full Code Here


    list.add(new DoublesPair(cpnFixed.getPaymentTime(), dfDr * dfBar));
    final Map<String, List<DoublesPair>> dfMap = new HashMap<>();
    dfMap.put(cpnFixed.getFundingCurveName(), list);
    InterestRateCurveSensitivity result = new InterestRateCurveSensitivity(dfMap);
    InterestRateCurveSensitivity pvLegFloatingDr = METHOD_COUPON_ON_CMP.presentValueCurveSensitivity(fixedCouponSwap.getSecondLeg().getNthPayment(0), curves);
    result = result.plus(pvLegFloatingDr.multipliedBy(pvFloatingBar));
    return result;
  }

  /**
   * Computes the physical annuity (also called PVBP or level) of the fixed leg of a swap.
View Full Code Here

    final List<DoublesPair> list = new ArrayList<>();
    list.add(new DoublesPair(cap.getPaymentTime(), dfDr));
    final Map<String, List<DoublesPair>> resultMap = new HashMap<>();
    resultMap.put(cap.getFundingCurveName(), list);
    InterestRateCurveSensitivity result = new InterestRateCurveSensitivity(resultMap);
    result = result.multipliedBy(bsAdjoint[0]);
    result = result.plus(forwardDr.multipliedBy(df * (bsAdjoint[1] + bsAdjoint[2] * volatilityAdjoint[1])));
    result = result.multipliedBy(cap.getNotional() * cap.getPaymentYearFraction());
    return result;
  }

View Full Code Here

    final Map<String, List<DoublesPair>> resultMap = new HashMap<>();
    resultMap.put(cap.getFundingCurveName(), list);
    InterestRateCurveSensitivity result = new InterestRateCurveSensitivity(resultMap);
    result = result.multipliedBy(bsAdjoint[0]);
    result = result.plus(forwardDr.multipliedBy(df * (bsAdjoint[1] + bsAdjoint[2] * volatilityAdjoint[1])));
    result = result.multipliedBy(cap.getNotional() * cap.getPaymentYearFraction());
    return result;
  }

  /**
   * Computes the present value SABR sensitivity of a cap/floor in the SABR model.
View Full Code Here

    list.add(new DoublesPair(cmsCapFloor.getPaymentTime(), sensiDF));
    final Map<String, List<DoublesPair>> resultMap = new HashMap<>();
    resultMap.put(cmsCapFloor.getUnderlyingSwap().getFixedLeg().getNthPayment(0).getFundingCurveName(), list);
    InterestRateCurveSensitivity result = new InterestRateCurveSensitivity(resultMap);
    final InterestRateCurveSensitivity forwardDr = new InterestRateCurveSensitivity(cmsCapFloor.getUnderlyingSwap().accept(PRSC, sabrData));
    result = result.plus(forwardDr.multipliedBy(deltaS0));
    return result;
  }

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

    for (int loopjump = 0; loopjump < nbJump; loopjump++) {
      final Map<Double, InterestRateCurveSensitivity> impactAmountDerivative = decision.getImpactAmountDerivative().get(loopjump);
      for (int loopimp = 0; loopimp < impactTime[loopjump].length; loopimp++) {
        final InterestRateCurveSensitivity sensiCfe = impactAmountDerivative.get(impactTime[loopjump][loopimp]);
        if (!(sensiCfe == null)) { // There is some sensitivity to that cfe.
          result = result.plus(sensiCfe.multipliedBy(impactAmountBar[loopjump][loopimp]));
        }
      }
    }
    result = result.cleaned();
    return result;
View Full Code Here

    final SABRInterestRateCorrelationParameters sabrCorrelation = SABRInterestRateCorrelationParameters.from(SABR_PARAMETERS, CORRELATION_FUNCTION);
    final SABRInterestRateDataBundle sabrBundleCor = new SABRInterestRateDataBundle(sabrCorrelation, CURVES);
    InterestRateCurveSensitivity pvcsLong = METHOD_CMS_SPREAD.presentValueCurveSensitivity(CMS_CAP_SPREAD, sabrBundleCor);
    pvcsLong = pvcsLong.cleaned();
    InterestRateCurveSensitivity pvcsShort = METHOD_CMS_SPREAD.presentValueCurveSensitivity(cmsCapSpreadShort, sabrBundleCor);
    pvcsShort = pvcsShort.multipliedBy(-1);
    pvcsShort = pvcsShort.cleaned();
    AssertSensivityObjects.assertEquals("CMS cap spread: Long/Short parity", pvcsLong, pvcsShort, TOLERANCE_PRICE);
  }

  @Test
View Full Code Here

    final SABRInterestRateCorrelationParameters sabrCorrelation = SABRInterestRateCorrelationParameters.from(SABR_PARAMETERS, CORRELATION_FUNCTION);
    final SABRInterestRateDataBundle sabrBundleCor = new SABRInterestRateDataBundle(sabrCorrelation, CURVES);
    InterestRateCurveSensitivity pvcsLong = METHOD_CMS_SPREAD.presentValueCurveSensitivity(CMS_FLOOR_SPREAD, sabrBundleCor);
    pvcsLong = pvcsLong.cleaned();
    InterestRateCurveSensitivity pvcsShort = METHOD_CMS_SPREAD.presentValueCurveSensitivity(cmsCapSpreadShort, sabrBundleCor);
    pvcsShort = pvcsShort.multipliedBy(-1);
    pvcsShort = pvcsShort.cleaned();
    AssertSensivityObjects.assertEquals("CMS floor spread: Long/Short parity", pvcsLong, pvcsShort, TOLERANCE_PRICE);
  }

  @Test
View Full Code Here

    final double rho = sabrData.getSABRParameter().getRho(expiryMaturity);
    final double nu = sabrData.getSABRParameter().getNu(expiryMaturity);
    final SABRFormulaData sabrParam = new SABRFormulaData(alpha, beta, rho, nu);
    final SABRExtrapolationRightFunction sabrExtrapolation = new SABRExtrapolationRightFunction(forward, sabrParam, _cutOffStrike, swaption.getTimeToExpiry(), _mu);
    final double price = sabrExtrapolation.price(swaption);
    result = result.multipliedBy(pvbp * price);
    result = result.plus(forwardDr.multipliedBy(discountFactorSettle * (pvbpDf * price + pvbp * sabrExtrapolation.priceDerivativeForward(swaption))));
    if (!swaption.isLong()) {
      result = result.multipliedBy(-1);
    }
    return result;
View Full Code Here

    final SABRExtrapolationRightFunction sabrExtrapolation = new SABRExtrapolationRightFunction(forward, sabrParam, _cutOffStrike, swaption.getTimeToExpiry(), _mu);
    final double price = sabrExtrapolation.price(swaption);
    result = result.multipliedBy(pvbp * price);
    result = result.plus(forwardDr.multipliedBy(discountFactorSettle * (pvbpDf * price + pvbp * sabrExtrapolation.priceDerivativeForward(swaption))));
    if (!swaption.isLong()) {
      result = result.multipliedBy(-1);
    }
    return result;
  }

  /**
 
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.