Examples of cleanPrice()


Examples of org.jquantlib.instruments.FixedRateBond.cleanPrice()

                      faceAmount,
                      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],
View Full Code Here

Examples of org.jquantlib.instruments.FixedRateBond.cleanPrice()

                        tolerance,
                        maxEvaluations);

                if (Math.abs(yields[m] - calculated) > tolerance) {
                  // the difference might not matter
                  final double price2 = bond.cleanPrice(calculated, bondDayCount, compounding[n], frequencies[l]);
                  if (Math.abs(price - price2) / price > tolerance) {
                                  fail(
                            "yield recalculation failed:\n" + "    issue:     " + issue + "\n"
                        + "    maturity:  " + maturity + "\n" + "    coupon:    " + coupons[k] + "\n"
                        + "    frequency: " + frequencies[l] + "\n\n" + "    yield:  " + yields[m] + " "
View Full Code Here

Examples of org.jquantlib.instruments.FixedRateBond.cleanPrice()

          for (final double yield : yields) {

            rate.setValue(yield);

            final double price = bond.cleanPrice(yield, bondDayCount, Compounding.Continuous, frequency);
            final double calculatedPrice = bond.getCleanPrice();

            if (Math.abs(price-calculatedPrice) > tolerance) {
              fail(
                  "price calculation failed:"
View Full Code Here

Examples of org.jquantlib.instruments.FixedRateBond.cleanPrice()

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


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

Examples of org.jquantlib.instruments.FixedRateBond.cleanPrice()

      final double marketYield3 = 0.02997;

      final Date settlementDate = new Date(30,Month.November,2004);
      final double cachedPrice3 = 99.764874;

      price = bond3.cleanPrice(marketYield3,
                               bondDayCount, Compounding.Compounded, freq, settlementDate);
      if (Math.abs(price-cachedPrice3) > tolerance) {
        fail("failed to reproduce cached price:"
                     + "\n    calculated: " + price + ""
                     + "\n    expected:   " + cachedPrice3 + ""
View Full Code Here

Examples of org.jquantlib.instruments.FixedRateBond.cleanPrice()

      // this should give the same result since the issue date is the
      // earliest possible settlement date

      settings.setEvaluationDate(new Date(22,Month.November,2004));

      price = bond3.cleanPrice(marketYield3, bondDayCount, Compounding.Compounded, freq);
      if (Math.abs(price-cachedPrice3) > tolerance) {
        fail("failed to reproduce cached price:"
                     + "\n    calculated: " + price + ""
                     + "\n    expected:   " + cachedPrice3 + ""
                     + "\n    error:      " + (price-cachedPrice3));
View Full Code Here

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

               "  " + fixedRateBond.NPV()
               "  " + floatingRateBond.NPV());
               
        System.out.println("Clean Price      "
            + "  " +zeroCouponBond.cleanPrice()
            + "  " +fixedRateBond.cleanPrice()
            + "  " + floatingRateBond.cleanPrice()
            );
       
        System.out.println("Dirty price      "
              + " " + zeroCouponBond.dirtyPrice()
View Full Code Here

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

                               vars.bondRedemption, issue);

            final PricingEngine bondEngine = new DiscountingBondEngine(curveHandle);
            bond.setPricingEngine(bondEngine);

            /*@Real*/ final double expectedPrice = bondData[i].price, estimatedPrice = bond.cleanPrice();
            /*@Real*/ final double error = Math.abs(expectedPrice-estimatedPrice);
            if (error > tolerance) {
              throw new RuntimeException(
                  String.format("#%d %s %s %f %s %f %s %f",
                  i+1, " bond failure:",
View Full Code Here

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

                      faceAmount,
                      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],
View Full Code Here

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

                        tolerance,
                        maxEvaluations);

                if (Math.abs(yields[m] - calculated) > tolerance) {
                  // the difference might not matter
                  final double price2 = bond.cleanPrice(calculated, bondDayCount, compounding[n], frequencies[l]);
                  if (Math.abs(price - price2) / price > tolerance) {
                                  fail(
                            "yield recalculation failed:\n" + "    issue:     " + issue + "\n"
                        + "    maturity:  " + maturity + "\n" + "    coupon:    " + coupons[k] + "\n"
                        + "    frequency: " + frequencies[l] + "\n\n" + "    yield:  " + yields[m] + " "
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.