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

Examples of com.opengamma.analytics.financial.interestrate.payments.derivative.CouponFixed


  public double calculatePriceForYield(final AnnuityCouponFixed annuity, final double yield) {
    Validate.notNull(annuity, "annuity");
    double sum = 0;

    final int n = annuity.getNumberOfPayments();
    CouponFixed temp;
    for (int i = 0; i < n; i++) {
      temp = annuity.getNthPayment(i);
      sum += temp.getAmount() * Math.exp(-yield * temp.getPaymentTime());
    }
    return sum;
  }
View Full Code Here


    double sum = 0;

    double t;
    double tPower;
    final int n = annuity.getNumberOfPayments();
    CouponFixed temp;
    for (int i = 0; i < n; i++) {
      temp = annuity.getNthPayment(i);
      t = temp.getPaymentTime();
      tPower = Math.pow(t, order);
      sum += temp.getAmount() * tPower * Math.exp(-yield * t);
    }
    return sum;
  }
View Full Code Here

    ArgumentChecker.notNull(yieldCurveName, "yield curve name");
    final int n = paymentTimes.length;
    ArgumentChecker.isTrue(yearFractions.length == n, "Number of year fractions must equal the number of payments");
    final CouponFixed[] temp = new CouponFixed[n];
    for (int i = 0; i < n; i++) {
      temp[i] = new CouponFixed(currency, paymentTimes[i], yieldCurveName, yearFractions[i], notional, couponRate);
    }
    return temp;
  }
View Full Code Here

    ArgumentChecker.isTrue(yearFractions.length > 0, "year fraction array is empty");
    final int n = paymentTimes.length;
    ArgumentChecker.isTrue(yearFractions.length == n, "Number of year fractions must equal the number of payments");
    final CouponFixed[] temp = new CouponFixed[n];
    for (int i = 0; i < n; i++) {
      temp[i] = new CouponFixed(currency, paymentTimes[i], yearFractions[i], notional, couponRate);
    }
    return temp;
  }
View Full Code Here

            cpnRate[loopcpn] = Math.min(Math.max(cpnFloor, cpnMain), cpnCap);
            calibration.add(new CapFloorIbor(cpn.getCurrency(), cpn.getPaymentTime(), cpn.getFundingCurveName(), cpn.getPaymentYearFraction(), cpn.getNotional(), cpn.getFixingTime(), cpn.getIndex(),
                cpn.getFixingPeriodStartTime(), cpn.getFixingPeriodEndTime(), cpn.getFixingAccrualFactor(), cpn.getForwardCurveName(), cpnRate[loopcpn], true));
          } else {
            if (getNthPayment(loopcpn) instanceof CouponFixed) {
              final CouponFixed cpn = (CouponFixed) getNthPayment(loopcpn);
              cpnRate[loopcpn] = cpn.getFixedRate();
            } else {
              final CouponIborGearing cpn = (CouponIborGearing) getNthPayment(loopcpn);
              final double ibor = prc.visitCouponIborGearing(cpn, curves);
              cpnRate[loopcpn] = cpn.getFactor() * ibor + cpn.getSpread();
            }
          }
        }
        break;

View Full Code Here

      final Double fixedEndIndex = getWeightEnd() * fixedEndIndex0 + (1 - getWeightEnd()) * fixedEndIndex1;
      final Double fixedStartIndex0 = priceIndexTimeSeries.getValue(getReferenceStartDate()[0]);
      final Double fixedStartIndex1 = priceIndexTimeSeries.getValue(getReferenceStartDate()[1]);
      final Double fixedStartIndex = getWeightStart() * fixedStartIndex0 + (1 - getWeightStart()) * fixedStartIndex1;
      final Double fixedRate = (fixedEndIndex / fixedStartIndex - (payNotional() ? 0.0 : 1.0)) + _factor;
      return new CouponFixed(getCurrency(), paymentTime, discountingCurveName, getPaymentYearFraction(), getNotional(), fixedRate);
    }
    final double[] referenceEndTime = new double[2];
    final double[] referenceStartTime = new double[2];
    referenceEndTime[0] = TimeCalculator.getTimeBetween(date, getReferenceEndDate()[0]);
    referenceEndTime[1] = TimeCalculator.getTimeBetween(date, getReferenceEndDate()[1]);
View Full Code Here

      final Double fixedEndIndex = getWeightEnd() * fixedEndIndex0 + (1 - getWeightEnd()) * fixedEndIndex1;
      final Double fixedStartIndex0 = priceIndexTimeSeries.getValue(getReferenceStartDate()[0]);
      final Double fixedStartIndex1 = priceIndexTimeSeries.getValue(getReferenceStartDate()[1]);
      final Double fixedStartIndex = getWeightStart() * fixedStartIndex0 + (1 - getWeightStart()) * fixedStartIndex1;
      final Double fixedRate = (fixedEndIndex / fixedStartIndex - (payNotional() ? 0.0 : 1.0)) + _factor;
      return new CouponFixed(getCurrency(), paymentTime, getPaymentYearFraction(), getNotional(), fixedRate);
    }
    final double[] referenceEndTime = new double[2];
    final double[] referenceStartTime = new double[2];
    referenceEndTime[0] = TimeCalculator.getTimeBetween(date, getReferenceEndDate()[0]);
    referenceEndTime[1] = TimeCalculator.getTimeBetween(date, getReferenceEndDate()[1]);
View Full Code Here

        }
        if (fixedRate == null) {
          throw new OpenGammaRuntimeException("Could not get fixing value for date " + getFixingDate());
        }
      }
      return new CouponFixed(getCurrency(), paymentTime, fundingCurveName, getPaymentYearFraction(), getNotional(), fixedRate - _rate);
    }

    // Ibor is not fixed yet, all the details are required.
    final double fixingTime = actAct.getDayCountFraction(zonedDate, getFixingDate(), _calendar);
    final double fixingPeriodStartTime = actAct.getDayCountFraction(zonedDate, getFixingPeriodStartDate(), _calendar);
View Full Code Here

        }
        if (fixedRate == null) {
          throw new OpenGammaRuntimeException("Could not get fixing value for date " + getFixingDate());
        }
      }
      return new CouponFixed(getCurrency(), paymentTime, getPaymentYearFraction(), getNotional(), fixedRate - _rate);
    }

    // Ibor is not fixed yet, all the details are required.
    final double fixingTime = actAct.getDayCountFraction(zonedDate, getFixingDate(), _calendar);
    final double fixingPeriodStartTime = actAct.getDayCountFraction(zonedDate, getFixingPeriodStartDate(), _calendar);
View Full Code Here

      final Double fixedEndIndex = getWeightEnd() * fixedEndIndex0 + (1 - getWeightEnd()) * fixedEndIndex1;
      final Double fixedStartIndex0 = priceIndexTimeSeries.getValue(getReferenceStartDates()[0]);
      final Double fixedStartIndex1 = priceIndexTimeSeries.getValue(getReferenceStartDates()[1]);
      final Double fixedStartIndex = getWeightStart() * fixedStartIndex0 + (1 - getWeightStart()) * fixedStartIndex1;
      final Double fixedRate = (fixedEndIndex / fixedStartIndex - (payNotional() ? 0.0 : 1.0));
      return new CouponFixed(getCurrency(), paymentTime, getPaymentYearFraction(), getNotional(), fixedRate);
    }
    final double[] referenceEndTime = new double[2];
    final double[] referenceStartTime = new double[2];
    referenceEndTime[0] = TimeCalculator.getTimeBetween(date, _referenceEndDates[0]);
    referenceEndTime[1] = TimeCalculator.getTimeBetween(date, _referenceEndDates[1]);
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.interestrate.payments.derivative.CouponFixed

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.