Package org.jquantlib.instruments.bonds

Examples of org.jquantlib.instruments.bonds.FixedRateBond.yield()


          + " " + fixedRateBond.nextCoupon()
          + " " + floatingRateBond.nextCoupon()
            );
        System.out.println( "Yield           "
          + " " + zeroCouponBond.yield(new Actual360(),Compounding.Compounded, Frequency.Annual)
          + " " + fixedRateBond.yield(new Actual360(),Compounding.Compounded, Frequency.Annual)
          + " " + floatingRateBond.yield(new Actual360(),Compounding.Compounded, Frequency.Annual)
            );

         // Other computations
        System.out.println("Sample indirect computations (for the floating rate bond): " );
View Full Code Here


                      sch,
                  new double[] { coupons[k] }, bondDayCount, paymentConvention, redemption, issue);

              for (int m = 0; m < (yields).length; m++) {
                final double price = bond.cleanPrice(yields[m], bondDayCount, compounding[n], frequencies[l]);
                final double calculated = bond.yield(
                        price,
                        bondDayCount,
                        compounding[n],
                        frequencies[l],
                        new Date(),
View Full Code Here

                  + "\n    expected:    " + price
                  + "\n    calculated': " + calculatedPrice
                  + "\n    error':      " + (price-calculatedPrice));
            }

            final double calculatedYield = bond.yield(
                bondDayCount, Compounding.Continuous, frequency,
                tolerance, maxEvaluations);
            if (Math.abs(yield-calculatedYield) > tolerance) {
                            fail(
                  "yield calculation failed:"
View Full Code Here

                     + "\n    expected:   " + cachedPrice2b
                     + "\n    tolerance:  " + tolerance
                     + "\n    error:      " + (price-cachedPrice2b));
      }

      yield = bond2.yield(marketPrice2, bondDayCount, Compounding.Compounded, freq);
      if (Math.abs(yield-cachedYield2a) > tolerance) {
        fail("failed to reproduce cached compounded yield:"
                     + "\n    calculated: " + yield
                     + "\n    expected:   " + cachedYield2a
                     + "\n    tolerance:  " + tolerance
View Full Code Here

                     + "\n    expected:   " + cachedYield2a
                     + "\n    tolerance:  " + tolerance
                     + "\n    error:      " + (yield-cachedYield2a));
      }

      yield = bond2.yield(marketPrice2, bondDayCount, Compounding.Continuous, freq);
      if (Math.abs(yield-cachedYield2b) > tolerance) {
        fail("failed to reproduce cached continuous yield:"
                     + "\n    calculated: " + yield
                     + "\n    expected:   " + cachedYield2b
                     + "\n    tolerance:  " + tolerance
View Full Code Here

                     + "\n    expected:   " + cachedYield2b
                     + "\n    tolerance:  " + tolerance
                     + "\n    error:      " + (yield-cachedYield2b));
      }

      yield = bond2.yield(bondDayCount, Compounding.Continuous, freq);
      if (Math.abs(yield-cachedYield2c) > tolerance) {
        fail("failed to reproduce cached continuous yield:"
                     + "\n    calculated: " + yield
                     + "\n    expected:   " + cachedYield2c
                     + "\n    tolerance:  " + tolerance
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.