Package com.opengamma.analytics.financial.interestrate.annuity.derivative

Examples of com.opengamma.analytics.financial.interestrate.annuity.derivative.AnnuityCouponFixed


   * @param discountingCurve The discounting curve.
   * @return The sensitivity.
   */
  public List<DoublesPair> presentValueBasisPointCurveSensitivity(final SwapFixedCoupon<? extends Payment> fixedCouponSwap, final DayCount dayCount,
      final Calendar calendar, final YieldAndDiscountCurve discountingCurve) {
    final AnnuityCouponFixed annuityFixed = fixedCouponSwap.getFixedLeg();
    double time;
    final List<DoublesPair> list = new ArrayList<>();
    for (int loopcpn = 0; loopcpn < annuityFixed.getPayments().length; loopcpn++) {
      time = annuityFixed.getNthPayment(loopcpn).getPaymentTime();
      final DoublesPair s = new DoublesPair(time, -time * discountingCurve.getDiscountFactor(time)
          * dayCount.getDayCountFraction(annuityFixed.getNthPayment(loopcpn).getAccrualStartDate(), annuityFixed.getNthPayment(loopcpn).getAccrualEndDate(), calendar)
          * Math.abs(annuityFixed.getNthPayment(loopcpn).getNotional()));
      list.add(s);
    }
    return list;
  }
View Full Code Here


   * @param discountingCurve The discounting curve.
   * @return The sensitivity.
   */
  public List<DoublesPair> presentValueBasisPointCurveSensitivity(final SwapFixedCoupon<? extends Payment> fixedCouponSwap, final DayCount dayCount,
      final YieldAndDiscountCurve discountingCurve) {
    final AnnuityCouponFixed annuityFixed = fixedCouponSwap.getFixedLeg();
    double time;
    final List<DoublesPair> list = new ArrayList<>();
    for (int loopcpn = 0; loopcpn < annuityFixed.getPayments().length; loopcpn++) {
      time = annuityFixed.getNthPayment(loopcpn).getPaymentTime();
      final DoublesPair s = new DoublesPair(time, -time * discountingCurve.getDiscountFactor(time)
          * dayCount.getDayCountFraction(annuityFixed.getNthPayment(loopcpn).getAccrualStartDate(), annuityFixed.getNthPayment(loopcpn).getAccrualEndDate())
          * Math.abs(annuityFixed.getNthPayment(loopcpn).getNotional()));
      list.add(s);
    }
    return list;
  }
View Full Code Here

   * @return The sensitivity.
   */
  public InterestRateCurveSensitivity presentValueBasisPointCurveSensitivity(final SwapFixedCoupon<? extends Payment> fixedCouponSwap, final DayCount dayCount,
      final Calendar calendar, final YieldCurveBundle curves) {
    final Map<String, List<DoublesPair>> result = new HashMap<>();
    final AnnuityCouponFixed annuityFixed = fixedCouponSwap.getFixedLeg();
    final YieldAndDiscountCurve discountingCurve = curves.getCurve(annuityFixed.getNthPayment(0).getFundingCurveName());
    result.put(annuityFixed.getNthPayment(0).getFundingCurveName(), presentValueBasisPointCurveSensitivity(fixedCouponSwap, dayCount, calendar, discountingCurve));
    return new InterestRateCurveSensitivity(result);
  }
View Full Code Here

   * @return The sensitivity.
   */
  public InterestRateCurveSensitivity presentValueBasisPointCurveSensitivity(final SwapFixedCoupon<? extends Payment> fixedCouponSwap, final DayCount dayCount,
      final YieldCurveBundle curves) {
    final Map<String, List<DoublesPair>> result = new HashMap<>();
    final AnnuityCouponFixed annuityFixed = fixedCouponSwap.getFixedLeg();
    final YieldAndDiscountCurve discountingCurve = curves.getCurve(annuityFixed.getNthPayment(0).getFundingCurveName());
    result.put(annuityFixed.getNthPayment(0).getFundingCurveName(), presentValueBasisPointCurveSensitivity(fixedCouponSwap, dayCount, discountingCurve));
    return new InterestRateCurveSensitivity(result);
  }
View Full Code Here

  public MultipleCurrencyAmount presentValue(final SwaptionCashFixedIbor swaption, final SABRSwaptionProviderInterface sabrData) {
    ArgumentChecker.notNull(swaption, "Swaption");
    ArgumentChecker.notNull(sabrData, "SABR swaption provider");
    MulticurveProviderInterface multicurves = sabrData.getMulticurveProvider();
    Currency ccy = swaption.getCurrency();
    final AnnuityCouponFixed annuityFixed = swaption.getUnderlyingSwap().getFixedLeg();
    final double nominal = Math.abs(annuityFixed.getNthPayment(0).getNotional());
    final double discountFactorSettle = multicurves.getDiscountFactor(ccy, swaption.getSettlementTime());
    final double annuityPhysical = METHOD_SWAP.presentValueBasisPoint(swaption.getUnderlyingSwap(), multicurves) / nominal;
    final double strike = swaption.getStrike();
    final double forward = swaption.getUnderlyingSwap().accept(PRDC, multicurves);
    // Linear approximation
    final double[] alpha = new double[2];
    for (int loopcpn = 0; loopcpn < annuityFixed.getNumberOfPayments(); loopcpn++) {
      alpha[1] += annuityFixed.getNthPayment(loopcpn).getPaymentYearFraction();
    }
    alpha[1] = 1 / alpha[1];
    alpha[0] = (discountFactorSettle / annuityPhysical - alpha[1]) / forward;

    final LinearTSRIntegrant integrant = new LinearTSRIntegrant(swaption, sabrData.getSABRParameter(), forward, alpha);
View Full Code Here

    public LinearTSRIntegrant(final SwaptionCashFixedIbor swaption, final SABRInterestRateParameters sabrParameter, final double forward, final double[] linear) {
      _forward = forward;
      _nbFixedPeriod = swaption.getUnderlyingSwap().getFixedLeg().getPayments().length;
      _nbFixedPaymentYear = (int) Math.round(1.0 / swaption.getUnderlyingSwap().getFixedLeg().getNthPayment(0).getPaymentYearFraction());
      _timeToExpiry = swaption.getTimeToExpiry();
      final AnnuityCouponFixed annuityFixed = swaption.getUnderlyingSwap().getFixedLeg();
      _maturity = annuityFixed.getNthPayment(annuityFixed.getNumberOfPayments() - 1).getPaymentTime() - swaption.getSettlementTime();
      final DoublesPair expiryMaturity = new DoublesPair(_timeToExpiry, _maturity);
      final double alpha = sabrParameter.getAlpha(expiryMaturity);
      final double beta = sabrParameter.getBeta(expiryMaturity);
      final double rho = sabrParameter.getRho(expiryMaturity);
      final double nu = sabrParameter.getNu(expiryMaturity);
View Full Code Here

   * @param swaption The swaption.
   * @return The basket.
   */
  public SwaptionPhysicalFixedIbor[] calibrationBasketFixedLegPeriod(final SwaptionPhysicalFixedIbor swaption) {
    ArgumentChecker.notNull(swaption, "swaption");
    final AnnuityCouponFixed legFixed = swaption.getUnderlyingSwap().getFixedLeg();
    final int nbCal = legFixed.getNumberOfPayments();
    final SwaptionPhysicalFixedIbor[] basket = new SwaptionPhysicalFixedIbor[nbCal];
    final double notional = Math.abs(legFixed.getNthPayment(0).getNotional());
    for (int loopcal = 0; loopcal < nbCal; loopcal++) {
      final double maturity = legFixed.getNthPayment(loopcal).getPaymentTime();
      final SwapFixedCoupon<? extends Payment> swap = swaption.getUnderlyingSwap().trimAfter(maturity).withNotional(notional);
      basket[loopcal] = SwaptionPhysicalFixedIbor.from(swaption.getTimeToExpiry(), swap, swaption.getSettlementTime(), true);
    }
    return basket;
  }
View Full Code Here

   * @return The basket.
   */
  public SwaptionPhysicalFixedIbor[] calibrationBasketFixedLegPeriod(final SwaptionPhysicalFixedIbor swaption, final double[] relativeMoneyness) {
    ArgumentChecker.notNull(swaption, "swaption");
    ArgumentChecker.notNull(relativeMoneyness, "relative moneyness");
    final AnnuityCouponFixed legFixed = swaption.getUnderlyingSwap().getFixedLeg();
    final int nbPeriods = legFixed.getNumberOfPayments();
    final int nbStrikes = relativeMoneyness.length;
    final SwaptionPhysicalFixedIbor[] basket = new SwaptionPhysicalFixedIbor[nbPeriods * nbStrikes];
    final double notional = 1; // Math.abs(legFixed.getNthPayment(0).getNotional());
    for (int loopcal = 0; loopcal < nbPeriods; loopcal++) {
      final double maturity = legFixed.getNthPayment(loopcal).getPaymentTime();
      final SwapFixedCoupon<? extends Payment> swap = swaption.getUnderlyingSwap().trimAfter(maturity).withNotional(notional);
      for (int loopstrike = 0; loopstrike < nbStrikes; loopstrike++) {
        basket[loopcal * nbStrikes + loopstrike] = SwaptionPhysicalFixedIbor.from(swaption.getTimeToExpiry(), swap.withRateShifted(relativeMoneyness[loopstrike]), swaption.getSettlementTime(), true);
      }
    }
View Full Code Here

   * @return The present value.
   */
  public CurrencyAmount presentValue(final SwaptionCashFixedIbor swaption, final SABRInterestRateDataBundle sabrData) {
    ArgumentChecker.notNull(swaption, "swaption");
    ArgumentChecker.notNull(sabrData, "SABR data");
    final AnnuityCouponFixed annuityFixed = swaption.getUnderlyingSwap().getFixedLeg();
    final double nominal = Math.abs(annuityFixed.getNthPayment(0).getNotional());
    final double discountFactorSettle = sabrData.getCurve(annuityFixed.getNthPayment(0).getFundingCurveName()).getDiscountFactor(swaption.getSettlementTime());
    final double annuityPhysical = METHOD_SWAP.presentValueBasisPoint(swaption.getUnderlyingSwap(), sabrData) / nominal;
    final double strike = swaption.getStrike();
    final double forward = swaption.getUnderlyingSwap().accept(PRC, sabrData);
    // Linear approximation
    final double[] alpha = new double[2];
    for (int loopcpn = 0; loopcpn < annuityFixed.getNumberOfPayments(); loopcpn++) {
      alpha[1] += annuityFixed.getNthPayment(loopcpn).getPaymentYearFraction();
    }
    alpha[1] = 1 / alpha[1];
    alpha[0] = (discountFactorSettle / annuityPhysical - alpha[1]) / forward;

    final LinearTSRIntegrant integrant = new LinearTSRIntegrant(swaption, sabrData.getSABRParameter(), forward, alpha);
View Full Code Here

    public LinearTSRIntegrant(final SwaptionCashFixedIbor swaption, final SABRInterestRateParameters sabrParameter, final double forward, final double[] linear) {
      _forward = forward;
      _nbFixedPeriod = swaption.getUnderlyingSwap().getFixedLeg().getPayments().length;
      _nbFixedPaymentYear = (int) Math.round(1.0 / swaption.getUnderlyingSwap().getFixedLeg().getNthPayment(0).getPaymentYearFraction());
      _timeToExpiry = swaption.getTimeToExpiry();
      final AnnuityCouponFixed annuityFixed = swaption.getUnderlyingSwap().getFixedLeg();
      _maturity = annuityFixed.getNthPayment(annuityFixed.getNumberOfPayments() - 1).getPaymentTime() - swaption.getSettlementTime();
      final DoublesPair expiryMaturity = new DoublesPair(_timeToExpiry, _maturity);
      final double alpha = sabrParameter.getAlpha(expiryMaturity);
      final double beta = sabrParameter.getBeta(expiryMaturity);
      final double rho = sabrParameter.getRho(expiryMaturity);
      final double nu = sabrParameter.getNu(expiryMaturity);
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.interestrate.annuity.derivative.AnnuityCouponFixed

Copyright © 2018 www.massapicom. 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.