Examples of cleanPrice()


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

          for (final double yield : yields) {

            rate.setValue(yield);

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

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

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

          for (final double yield : yields) {

            rate.setValue(yield);

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

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

Examples of org.jquantlib.instruments.bonds.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.bonds.FixedRateBond.cleanPrice()

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

      price = bond2.cleanPrice();
      if (Math.abs(price-cachedPrice2b) > tolerance) {
        fail("failed to reproduce cached price:"
                     + "\n    calculated: " + price
                     + "\n    expected:   " + cachedPrice2b
                     + "\n    tolerance:  " + tolerance
View Full Code Here

Examples of org.jquantlib.instruments.bonds.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.bonds.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()

      final PricingEngine bondEngine = new DiscountingBondEngine(discountCurve);
      bond1.setPricingEngine(bondEngine);

      final double cachedPrice1 = 99.298100;

      double price = bond1.cleanPrice();
      if (Math.abs(price-cachedPrice1) > tolerance) {
          fail("failed to reproduce cached price:\n"
                     + "    calculated: " + price + "\n"
                     + "    expected:   " + cachedPrice1 + "\n"
                     + "    error:      " + (price-cachedPrice1));
View Full Code Here

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

      bond2.setPricingEngine(bondEngine);

      final double cachedPrice2 = 100.334149;

      price = bond2.cleanPrice();
      if (Math.abs(price-cachedPrice2) > tolerance) {
          fail("failed to reproduce cached price:\n"
                     + "    calculated: " + price + "\n"
                     + "    expected:   " + cachedPrice2 + "\n"
                     + "    error:      " + (price-cachedPrice2));
View Full Code Here

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

      bond3.setPricingEngine(bondEngine);

      final double cachedPrice3 = 100.382794;

      price = bond3.cleanPrice();
      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.FloatingRateBond.cleanPrice()

               "  " + floatingRateBond.NPV());
               
        System.out.println("Clean Price      "
            + "  " +zeroCouponBond.cleanPrice()
            + "  " +fixedRateBond.cleanPrice()
            + "  " + floatingRateBond.cleanPrice()
            );
       
        System.out.println("Dirty price      "
              + " " + zeroCouponBond.dirtyPrice()
              + " " + fixedRateBond.dirtyPrice()
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.