Examples of MakeVanillaSwap


Examples of org.jquantlib.instruments.MakeVanillaSwap

    protected void initializeDates() {
        // dummy ibor index with curve/swap arguments
        final IborIndex clonedIborIndex = iborIndex.clone(this.termStructureHandle);

        // do not pass the spread here, as it might be a Quote i.e. it can dinamically change
        this.swap = new MakeVanillaSwap(tenor, clonedIborIndex, 0.0, fwdStart)
        .withFixedLegDayCount(fixedDayCount)
        .withFixedLegTenor(new Period(fixedFrequency))
        .withFixedLegConvention(fixedConvention)
        .withFixedLegTerminationDateConvention(fixedConvention)
        .withFixedLegCalendar(calendar)
View Full Code Here

Examples of org.jquantlib.instruments.MakeVanillaSwap

        return fixedLegConvention;
    }

    public VanillaSwap underlyingSwap(final Date fixingDate) /* @ReadOnly */ {
        /*@Rate*/ final double fixedRate = 0.0;
        return new MakeVanillaSwap(tenor, iborIndex, fixedRate)
        .withEffectiveDate(valueDate(fixingDate))
        .withFixedLegCalendar(fixingCalendar())
        .withFixedLegDayCount(dayCounter)
        .withFixedLegTenor(fixedLegTenor)
        .withFixedLegConvention(fixedLegConvention)
View Full Code Here

Examples of org.jquantlib.instruments.MakeVanillaSwap

        // 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)
                .withFixedLegDayCount(vars.fixedLegDayCounter)
                .withFixedLegTenor(new Period(vars.fixedLegFrequency))
                .withFixedLegConvention(vars.fixedLegConvention)
                .withFixedLegTerminationDateConvention(vars.fixedLegConvention)
View Full Code Here

Examples of org.jquantlib.instruments.MakeVanillaSwap

      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++) {
          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)
View Full Code Here

Examples of org.jquantlib.instruments.MakeVanillaSwap

      // check swaps
      final IborIndex jpylibor6m = new JPYLibor(new Period(6, TimeUnit.Months), 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, jpylibor6m, 0.0)
              .withEffectiveDate(vars.settlement)
              .withFixedLegDayCount(vars.fixedLegDayCounter)
              .withFixedLegTenor(new Period(vars.fixedLegFrequency))
              .withFixedLegConvention(vars.fixedLegConvention)
              .withFixedLegTerminationDateConvention(vars.fixedLegConvention)
View Full Code Here

Examples of org.jquantlib.instruments.MakeVanillaSwap

    protected void initializeDates() {
        // dummy ibor index with curve/swap arguments
        final IborIndex clonedIborIndex = iborIndex.clone(this.termStructureHandle).currentLink();

        // do not pass the spread here, as it might be a Quote i.e. it can dynamically change
        this.swap = new MakeVanillaSwap(tenor, clonedIborIndex, 0.0, fwdStart)
        .withFixedLegDayCount(fixedDayCount)
        .withFixedLegTenor(new Period(fixedFrequency))
        .withFixedLegConvention(fixedConvention)
        .withFixedLegTerminationDateConvention(fixedConvention)
        .withFixedLegCalendar(calendar)
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.