Package org.jquantlib.time

Examples of org.jquantlib.time.MakeSchedule


    public String name() {
        return "BMA";
    }
           
    public Schedule fixingSchedule(final Date start, final Date end) {
      return (new MakeSchedule(previousWednesday(start),
                  nextWednesday(end),
                  new Period (1,TimeUnit.Weeks),
                  fixingCalendar,               
                  BusinessDayConvention.Following)).forwards().schedule();
    }
View Full Code Here


        final BMAIndex bma = new BMAIndex(curveHandle);
        final IborIndex libor3m = new USDLibor(new Period(3, TimeUnit.Months), riskFreeCurve);
        for (int i=0; i<vars.bmas; i++) {
            final Period tenor = new Period(bmaData[i].n, bmaData[i].units);

            final Schedule bmaSchedule = new MakeSchedule(vars.settlement,
                                                  vars.settlement.add(tenor),
                                                  new Period(vars.bmaFrequency),
                                                  bma.fixingCalendar(),
                                                  vars.bmaConvention)
                                    .backwards()
                                    .schedule();
            final Schedule liborSchedule = new MakeSchedule(vars.settlement,
                                                      vars.settlement.add(tenor),
                                                      libor3m.tenor(),
                                                      libor3m.fixingCalendar(),
                                                      libor3m.businessDayConvention())
                                      .endOfMonth(libor3m.endOfMonth())
View Full Code Here

    final Handle<YieldTermStructure> discountCurve = new Handle<YieldTermStructure>(
        new ForwardSpreadedTermStructure(vars.riskFreeRate,
            vars.creditSpread));

    // zero-coupon
    Schedule schedule = new MakeSchedule(vars.issueDate, vars.maturityDate,
        new Period(Frequency.Once), vars.calendar,
        BusinessDayConvention.Following).backwards().schedule();

    final ConvertibleZeroCouponBond euZero = new ConvertibleZeroCouponBond(
        euExercise, vars.conversionRatio, vars.no_dividends,
        vars.no_callability, vars.creditSpread, vars.issueDate,
        vars.settlementDays, vars.dayCounter, schedule, vars.redemption);
    euZero.setPricingEngine(engine);

    final ConvertibleZeroCouponBond amZero = new ConvertibleZeroCouponBond(
        amExercise, vars.conversionRatio, vars.no_dividends,
        vars.no_callability, vars.creditSpread, vars.issueDate,
        vars.settlementDays, vars.dayCounter, schedule, vars.redemption);
    amZero.setPricingEngine(engine);

    final ZeroCouponBond zero = new ZeroCouponBond(vars.settlementDays,
        vars.calendar, 100.0, vars.maturityDate,
        BusinessDayConvention.Following, vars.redemption,
        vars.issueDate);

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

    double tolerance = 1.0e-2 * (vars.faceAmount / 100.0);

    double error = Math.abs(euZero.NPV() - zero.settlementValue());
    if (error > tolerance) {
      fail("failed to reproduce zero-coupon bond price:"
          + "\n    calculated: " + euZero.NPV()
          + "\n    expected:   " + zero.settlementValue()
          + "\n    error:      " + error);
    }

    error = Math.abs(amZero.NPV() - zero.settlementValue());
    if (error > tolerance) {
      fail("failed to reproduce zero-coupon bond price:"
          + "\n    calculated: " + amZero.NPV()
          + "\n    expected:   " + zero.settlementValue()
          + "\n    error:      " + error);
    }

    // coupon

    final double[] coupons = { 0.05 };

    schedule = new MakeSchedule(vars.issueDate, vars.maturityDate,
        new Period(vars.frequency), vars.calendar,
        BusinessDayConvention.Following).backwards().schedule();

    final ConvertibleFixedCouponBond euFixed = new ConvertibleFixedCouponBond(
        euExercise, vars.conversionRatio, vars.no_dividends,
View Full Code Here

    final double conversionStrike = vars.redemption / vars.conversionRatio;
    final StrikedTypePayoff payoff = new PlainVanillaPayoff(Option.Type.Call,
        conversionStrike);

    final Schedule schedule = new MakeSchedule(vars.issueDate, vars.maturityDate,
        new Period(Frequency.Once), vars.calendar,
        BusinessDayConvention.Following).backwards().schedule();

    final ConvertibleZeroCouponBond euZero = new ConvertibleZeroCouponBond(
        euExercise, vars.conversionRatio, vars.no_dividends,
View Full Code Here

                                  BusinessDayConvention.Following);
     

      Date maturity = earliestDate.add(tenor);
      BMAIndex clonedIndex = bmaIndex.clone(termStructureHandle);
      Schedule bmaSchedule = new MakeSchedule(earliestDate,
                                          maturity,
                                          bmaPeriod,
                                          bmaIndex.fixingCalendar(),
                                          bmaConvention)
                    .backwards()
                    .schedule();
     
      Schedule liborSchedule = new MakeSchedule(earliestDate,
                                  maturity,
                                  iborIndex.tenor(),
                                  iborIndex.fixingCalendar(),
                                  iborIndex.businessDayConvention())
                    .endOfMonth(iborIndex.endOfMonth())
View Full Code Here

TOP

Related Classes of org.jquantlib.time.MakeSchedule

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.