Package org.jquantlib.termstructures

Examples of org.jquantlib.termstructures.InterestRate


    private double  rebate()  {
        return a.rebate;
    }

    private double /*@Rate*/  riskFreeRate()  {
        final InterestRate rate =  this.process.riskFreeRate().currentLink().zeroRate(residualTime(), Compounding.Continuous,
                Frequency.NoFrequency, false);
        return rate.rate();
    }
View Full Code Here


    private double /*@DiscountFactor*/  riskFreeDiscount()  {
        return this.process.riskFreeRate().currentLink().discount(residualTime());
    }

    private double /*@Rate*/  dividendYield()  {
        final InterestRate yield = this.process.dividendYield().currentLink().zeroRate(
                residualTime(), Compounding.Continuous, Frequency.NoFrequency, false);
        return yield.rate();
    }
View Full Code Here

     * #initializeStepCondition()
     */
    @Override
    protected void initializeStepCondition() {
        final double residualTime = getResidualTime();
        final InterestRate riskFreeRate = process.riskFreeRate().currentLink().zeroRate(
                residualTime, Compounding.Continuous, Frequency.Annual, false);

        stepCondition = new ShoutCondition(intrinsicValues.values(), residualTime, riskFreeRate.rate());
    }
View Full Code Here

      // The tolerance is high because Andima truncate yields
      final double tolerance = 1.0e-4;

      final InterestRate [] couponRates = new InterestRate[1];
      couponRates[0] = new InterestRate(0.1,new Thirty360(),Compounding.Compounded,Frequency.Annual);

      for (int bondIndex = 0; bondIndex < maturityDates.length; bondIndex++) {

          // plain
          final InterestRate yield = new InterestRate(yields[bondIndex],
                             new Business252(new Brazil()),
                             Compounding.Compounded, Frequency.Annual);

          final Schedule schedule = new Schedule(new Date(1,Month.January,2007),
                            maturityDates[bondIndex], new Period(Frequency.Semiannual),
                            new Brazil(Brazil.Market.SETTLEMENT),
                            BusinessDayConvention.Unadjusted, BusinessDayConvention.Unadjusted,
                            DateGeneration.Rule.Backward, false);

          // fixed coupons
          final Leg cashflows =
              new FixedRateLeg(schedule, new Actual360())
              .withNotionals(faceAmount)
              .withCouponRates(couponRates)
              .withPaymentAdjustment(BusinessDayConvention.ModifiedFollowing).Leg();
          // redemption
          cashflows.add(new SimpleCashFlow(faceAmount, cashflows.last().date()));

          final Bond bond = new Bond(settlementDays, new Brazil(Brazil.Market.SETTLEMENT),
                    faceAmount, cashflows.last().date(),
                    new Date(1,Month.January,2007), cashflows);

          final double cachedPrice = prices[bondIndex];

          final double price = faceAmount*bond.dirtyPrice(yield.rate(),
                                                       yield.dayCounter(),
                                                       yield.compounding(),
                                                       yield.frequency(),
                                                       today)/100;
          if (Math.abs(price-cachedPrice) > tolerance) {
              fail("failed to reproduce cached price:\n"
                          + "    calculated: " + price + "\n"
                          + "    expected:   " + cachedPrice + "\n"
View Full Code Here

    //

    @Override
    protected double zeroYieldImpl(final double t) {
        //org.comment: to be fixed: user-defined daycounter should be used
        final InterestRate zeroRate = originalCurve.currentLink().
        zeroRate(t, comp, freq, true);
        final InterestRate spreadedRate =
            new InterestRate(zeroRate.rate() + spread.currentLink().value(),
                    zeroRate.dayCounter(),
                    zeroRate.compounding(),
                    zeroRate.frequency());
        return spreadedRate.equivalentRate(t, Compounding.Continuous, Frequency.NoFrequency).rate();
    }
View Full Code Here

    //
    // private methods
    //

    private void updateRate() {
        rate = new InterestRate(forward.currentLink().value(), this.dayCounter(), this.compounding, this.frequency);
    }
View Full Code Here

TOP

Related Classes of org.jquantlib.termstructures.InterestRate

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.