Package org.jquantlib.indexes

Examples of org.jquantlib.indexes.Euribor6M


        // setup swaps
        final Frequency swFixedLegFrequency = Frequency.Annual;
        final BusinessDayConvention swFixedLegConvention = BusinessDayConvention.Unadjusted;
        final DayCounter swFixedLegDayCounter = new Thirty360(Convention.European);
        final IborIndex  swFloatingLegIndex = new Euribor6M(new Handle<YieldTermStructure>());

        // TODO and FIXME: not sure whether the class stuff works properly
        // final IborIndex swFloatingLegIndex = Euribor.getEuribor6M(new Handle<YieldTermStructure>(YieldTermStructure.class)); //FIXME::RG::Handle
//        final YieldTermStructure nullYieldTermStructure = new AbstractYieldTermStructure() {
//            @Override
View Full Code Here


                      "\n    expected rate:  ", expectedRate));
            }
        }

        // check swaps
        final IborIndex euribor6m = new Euribor6M(curveHandle);
        for (int i=0; i<vars.swaps; i++) {
            final Period tenor = new Period(swapData[i].n, swapData[i].units);

            final VanillaSwap swap = new MakeVanillaSwap(tenor, euribor6m, 0.0)
                .withEffectiveDate(vars.settlement)
View Full Code Here

      QL.info("Testing use of today's LIBOR fixings in swap curve...");

      final CommonVars vars = new CommonVars();

      final RateHelper[] swapHelpers = new RateHelper[vars.swaps];
      final IborIndex euribor6m = new Euribor6M();

      for (int i=0; i<vars.swaps; i++) {
          final Handle<Quote> r = new Handle<Quote>(vars.rates[i+vars.deposits]);
          swapHelpers[i] = new SwapRateHelper(
                         r, new Period(swapData[i].n, swapData[i].units),
                             vars.calendar,
                             vars.fixedLegFrequency, vars.fixedLegConvention,
                             vars.fixedLegDayCounter, euribor6m);
      }

      vars.termStructure = new PiecewiseYieldCurve(
                  Discount.class, LogLinear.class, IterativeBootstrap.class,
                  vars.settlement,
                  swapHelpers,
                          new Actual360());

      final Handle<YieldTermStructure> curveHandle = new Handle<YieldTermStructure>(vars.termStructure);

      final IborIndex index = new Euribor6M(curveHandle);
      for (int i=0; i<vars.swaps; i++) {
          final Period tenor = new Period(swapData[i].n, swapData[i].units);

          final VanillaSwap swap = new MakeVanillaSwap(tenor, index, 0.0)
              .withEffectiveDate(vars.settlement)
              .withFixedLegDayCount(vars.fixedLegDayCounter)
              .withFixedLegTenor(new Period(vars.fixedLegFrequency))
              .withFixedLegConvention(vars.fixedLegConvention)
              .withFixedLegTerminationDateConvention(vars.fixedLegConvention)
                  .value();

          /*@Rate*/ final double expectedRate  = swapData[i].rate/100;
          /*@Rate*/ final double estimatedRate = swap.fairRate();
          /*@Real*/ final double tolerance = 1.0e-9;
          if (Math.abs(expectedRate-estimatedRate) > tolerance) {
            throw new RuntimeException(
                String.format("%s %d %s %s %f %s %s %f",
                  "before LIBOR fixing:\n",
                          swapData[i].n, " year(s) swap:\n",
                          "    estimated rate: ", estimatedRate, "\n",
                          "    expected rate:  ", expectedRate));
          }
      }

      final Flag f = new Flag();
      vars.termStructure.addObserver(f);
      f.lower();

      index.addFixing(vars.today, 0.0425);

      if (!f.isUp())
          throw new RuntimeException("Observer was not notified of rate fixing");

      for (int i=0; i<vars.swaps; i++) {
View Full Code Here

TOP

Related Classes of org.jquantlib.indexes.Euribor6M

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.