Package com.opengamma.analytics.financial.interestrate

Examples of com.opengamma.analytics.financial.interestrate.ContinuousInterestRate


   * @param compoundingPeriodsPerYear The number of composition per year.
   * @return The rate in the requested composition.
   */
  public double getPeriodicInterestRate(final double t, final int compoundingPeriodsPerYear) {
    final double rcc = getInterestRate(t);
    final ContinuousInterestRate cont = new ContinuousInterestRate(rcc);
    return cont.toPeriodic(compoundingPeriodsPerYear).getRate();
  }
View Full Code Here


  public static YieldPeriodicCurve fromYieldsInterpolated(final double[] nodePoints, final double[] yields, final int compoundingPeriodsPerYear, final Interpolator1D interpolator, final String name) {
    final int nbYields = yields.length;
    ArgumentChecker.isTrue(nodePoints.length == nbYields, "Yields array of incorrect length");
    final double[] yieldPeriodic = new double[nbYields];
    for (int loopy = 0; loopy < nbYields; loopy++) {
      final InterestRate continous = new ContinuousInterestRate(yields[loopy]);
      yieldPeriodic[loopy] = continous.toPeriodic(compoundingPeriodsPerYear).getRate();
    }
    final InterpolatedDoublesCurve curve = new InterpolatedDoublesCurve(nodePoints, yieldPeriodic, interpolator, false);
    return new YieldPeriodicCurve(name, compoundingPeriodsPerYear, curve);
  }
View Full Code Here

    final DepositZero deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate, CURVES_NAME[0]);
    final double prMethod = METHOD_DEPOSIT.parRate(deposit, CURVES);
    final double dfEnd = CURVES.getCurve(CURVES_NAME[0]).getDiscountFactor(deposit.getEndTime());
    final double dfStart = CURVES.getCurve(CURVES_NAME[0]).getDiscountFactor(deposit.getStartTime());
    final double rcc = Math.log(dfStart / dfEnd) / deposit.getPaymentAccrualFactor();
    final double prExpected = deposit.getRate().fromContinuous(new ContinuousInterestRate(rcc)).getRate();
    assertEquals("DepositZero: par rate", prExpected, prMethod, TOLERANCE_RATE);
    final double prCalculator = deposit.accept(PRC, CURVES);
    assertEquals("DepositZero: par rate", prMethod, prCalculator, TOLERANCE_RATE);
  }
View Full Code Here

    final DepositZero deposit = DEPOSIT_DEFINITION.toDerivative(referenceDate, CURVES_NAME[0]);
    final double prMethod = METHOD_DEPOSIT.parRate(deposit, CURVES);
    final double dfEnd = CURVES.getCurve(CURVES_NAME[0]).getDiscountFactor(deposit.getEndTime());
    final double dfStart = 1.0;
    final double rcc = Math.log(dfStart / dfEnd) / deposit.getPaymentAccrualFactor();
    final double prExpected = deposit.getRate().fromContinuous(new ContinuousInterestRate(rcc)).getRate();
    assertEquals("DepositZero: par rate", prExpected, prMethod, TOLERANCE_RATE);
    final double prCalculator = deposit.accept(PRC, CURVES);
    assertEquals("DepositZero: par rate", prMethod, prCalculator, TOLERANCE_RATE);
  }
View Full Code Here

  public double parRate(final DepositZero deposit, final YieldCurveBundle curves) {
    final YieldAndDiscountCurve dsc = curves.getCurve(deposit.getDiscountingCurveName());
    final double startTime = deposit.getStartTime();
    final double endTime = deposit.getEndTime();
    final double rcc = Math.log(dsc.getDiscountFactor(startTime) / dsc.getDiscountFactor(endTime)) / deposit.getPaymentAccrualFactor();
    final InterestRate rate = deposit.getRate().fromContinuous(new ContinuousInterestRate(rcc));
    return rate.getRate();
  }
View Full Code Here

    final YieldAndDiscountCurve dsc = curves.getCurve(deposit.getDiscountingCurveName());
    final double dfStartTime = dsc.getDiscountFactor(deposit.getStartTime());
    final double dfEndTime = dsc.getDiscountFactor(deposit.getEndTime());
    final double rcc = Math.log(dfStartTime / dfEndTime) / deposit.getPaymentAccrualFactor();
    final double rateBar = 1.0;
    final double rccBar = deposit.getRate().fromContinuousDerivative(new ContinuousInterestRate(rcc)) * rateBar;
    final double dfEndTimeBar = -1.0 / dfEndTime / deposit.getPaymentAccrualFactor() * rccBar;
    final double dfStartTimeBar = 1.0 / dfStartTime / deposit.getPaymentAccrualFactor() * rccBar;
    final Map<String, List<DoublesPair>> resultMapDsc = new HashMap<>();
    final List<DoublesPair> listDiscounting = new ArrayList<>();
    listDiscounting.add(new DoublesPair(deposit.getStartTime(), -deposit.getStartTime() * dfStartTime * dfStartTimeBar));
 
View Full Code Here

    ArgumentChecker.notNull(deposit, "deposit");
    ArgumentChecker.notNull(curves, "curves");
    final double dfStart = curves.getCurve(deposit.getDiscountingCurveName()).getDiscountFactor(deposit.getStartTime());
    final double dfEnd = curves.getCurve(deposit.getDiscountingCurveName()).getDiscountFactor(deposit.getEndTime());
    final double ccrs = Math.log(deposit.getInitialAmount() * dfStart / (deposit.getNotional() * dfEnd)) / deposit.getPaymentAccrualFactor();
    final InterestRate rs = deposit.getRate().fromContinuous(new ContinuousInterestRate(ccrs));
    return rs.getRate() - deposit.getRate().getRate();
  }
View Full Code Here

    final double dfEnd = curves.getCurve(deposit.getDiscountingCurveName()).getDiscountFactor(deposit.getEndTime());
    final double ccrs = Math.log(deposit.getInitialAmount() * dfStart / (deposit.getNotional() * dfEnd)) / deposit.getPaymentAccrualFactor();
    // Backward sweep
    final double parSpreadBar = 1.0;
    final double rsBar = parSpreadBar;
    final double ccrsBar = deposit.getRate().fromContinuousDerivative(new ContinuousInterestRate(ccrs)) * rsBar;
    final double dfEndBar = -1 / (dfEnd * deposit.getPaymentAccrualFactor()) * ccrsBar;
    final double dfStartBar = 1 / (dfEnd * deposit.getPaymentAccrualFactor()) * ccrsBar;
    final Map<String, List<DoublesPair>> resultMapDsc = new HashMap<>();
    final List<DoublesPair> listDiscounting = new ArrayList<>();
    listDiscounting.add(new DoublesPair(deposit.getStartTime(), -deposit.getStartTime() * dfStart * dfStartBar));
 
View Full Code Here

    final Currency currency = security.getCurrency();
    final ZonedDateTime startDate = security.getStartDate();
    final ZonedDateTime endDate = security.getMaturityDate();
    final ConventionBundle convention = _conventionSource.getConventionBundle(ExternalId.of(InMemoryConventionBundleMaster.SIMPLE_NAME_SCHEME, currency.getCode() + "_ZERO_DEPOSIT"));
    final DayCount daycount = convention.getDayCount();
    final InterestRate rate = new ContinuousInterestRate(security.getRate());
    final Calendar calendar = new HolidaySourceCalendarAdapter(_holidaySource, currency);
    return DepositZeroDefinition.from(currency, startDate, endDate, daycount, rate, calendar);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.interestrate.ContinuousInterestRate

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.