Package org.jquantlib.pricingengines

Examples of org.jquantlib.pricingengines.PricingEngine


                        final BlackScholesMertonProcess stochProcess = new BlackScholesMertonProcess(
                                new Handle<Quote>(spot),
                                new Handle<YieldTermStructure>(qTS),
                                new Handle<YieldTermStructure>(rTS),
                                new Handle<BlackVolTermStructure>(volTS));
                        final PricingEngine engine = new AnalyticEuropeanEngine(stochProcess);

                        if (payoff==null)
                            throw new IllegalArgumentException();

                        final EuropeanOption option = new EuropeanOption(payoff, exercise);
View Full Code Here


        final BlackScholesMertonProcess stochProcess = new BlackScholesMertonProcess(
                new Handle<Quote>(u),
                new Handle<YieldTermStructure>(qTS),
                new Handle<YieldTermStructure>(rTS),
                new Handle<BlackVolTermStructure>(volTS));
        final PricingEngine engine = new AnalyticEuropeanEngine(stochProcess);

        final EuropeanOption option1 = new EuropeanOption(payoff, exercise);
        final EuropeanOption option2 = new EuropeanOption(payoff, exercise);
        option1.setPricingEngine(engine);
        option2.setPricingEngine(engine);
View Full Code Here

                new Handle<YieldTermStructure>(rTS),
                new Handle<BlackVolTermStructure>(volTS),
                new Handle<Quote>(jumpIntensity),
                new Handle<Quote>(meanLogJump),
                new Handle<Quote>(jumpVol));
        final PricingEngine engine = new JumpDiffusionEngine(stochProcess);

        for (final HaugMertonData value : values) {
            final StrikedTypePayoff payoff = new PlainVanillaPayoff(value.type, value.strike);

            final Date exDate = today.add((int) (value.t * 360 + 0.5));
View Full Code Here

                new Handle<Quote>(meanLogJump),
                new Handle<Quote>(jumpVol));

        // The jumpdiffusionengine greeks are very sensitive to the convergence level.
        // A tolerance of 1.0e-08 is usually sufficient to get reasonable results
        final PricingEngine engine = new JumpDiffusionEngine(stochProcess, 1e-08);

        for (final Type type : types) {
            for (final double strike : strikes) {
                for (final double element : jInt) {
                    jumpIntensity.setValue(element);
View Full Code Here

            /* @Size */final int binomialSteps,
            /* @Size */final int samples) {

        final GeneralizedBlackScholesProcess stochProcess = makeProcess(u, q, r, vol);

        PricingEngine engine;
        switch (engineType) {
        case Analytic:
            engine = new AnalyticEuropeanEngine(stochProcess);
            break;
        case JR:
View Full Code Here

                  settlementDays, faceAmount, sch,
              new double[] { coupon },
              bondDayCount, paymentConvention,
              redemption, issue);

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

          for (final double yield : yields) {

            rate.setValue(yield);
View Full Code Here

      final FixedRateBond bond1 = new FixedRateBond(settlementDays, faceAmount, sch1,
                          new double[] {0.025},
                          bondDayCount, BusinessDayConvention.ModifiedFollowing,
                          100.0, new Date(1, Month.November, 2004));

    final PricingEngine bondEngine = new DiscountingBondEngine(discountCurve);

      bond1.setPricingEngine(bondEngine);

      final double marketPrice1 = 99.203125;
      final double marketYield1 = 0.02925;
View Full Code Here

                           faceAmount,
                           new Date(30,Month.November,2008),
                           BusinessDayConvention.ModifiedFollowing,
                           100.0, new Date(30,Month.November,2004));

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

      final double cachedPrice1 = 88.551726;

      double price = bond1.cleanPrice();
View Full Code Here

                          new double [] { 0.02875 },
                          new ActualActual(ActualActual.Convention.ISMA),
                          BusinessDayConvention.ModifiedFollowing,
                          100.0, new Date(30,Month.November,2004));

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

      final double cachedPrice1 = 99.298100;

      double price = bond1.cleanPrice();
View Full Code Here

                             new Array(0), new Array(0),
                             new Array(0), new Array(0),
                             false,
                             100.0, new Date(30,Month.November,2004));

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

      PricerSetter.setCouponPricer(bond1.cashflows(),pricer);

      final boolean indexedCoupon = new Settings().isUseIndexedCoupon();
     
      final double cachedPrice1 = indexedCoupon ? 99.874645 : 99.874646;

      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));
      }

      // different risk-free and discount curve

      final FloatingRateBond bond2 = new FloatingRateBond(settlementDays, vars.faceAmount, sch,
                             index, new ActualActual(ActualActual.Convention.ISMA),
                             BusinessDayConvention.ModifiedFollowing, fixingDays,
                             new Array(0), new Array(0),
                             new Array(0), new Array(0),
                             false,
                             100.0, new Date(30,Month.November,2004));

      final PricingEngine bondEngine2 = new DiscountingBondEngine(discountCurve);
      bond2.setPricingEngine(bondEngine2);

      PricerSetter.setCouponPricer(bond2.cashflows(),pricer);

        final double cachedPrice2 = indexedCoupon ? 97.955904 : 97.955904; // yes, they are the same, according to QuantLib/C++
View Full Code Here

TOP

Related Classes of org.jquantlib.pricingengines.PricingEngine

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.