Package org.jquantlib.indexes.ibor

Examples of org.jquantlib.indexes.ibor.USDLibor


                new USDCurrency(),
                new Target(),
                new Period(6,TimeUnit.Months),
                BusinessDayConvention.ModifiedFollowing,
                new Thirty360(Thirty360.Convention.BondBasis),
                new USDLibor(new Period(3,TimeUnit.Months), h)
                   
                );
        }
View Full Code Here


       
         // Floating rate bond (3M USD Libor + 0.1%)
         // Should and will be priced on another curve later...
       
         final RelinkableHandle<YieldTermStructure> liborTermStructure = new RelinkableHandle<YieldTermStructure>();
         final IborIndex libor3m =  new USDLibor(new Period(3, TimeUnit.Months), liborTermStructure);
         libor3m.addFixing(new Date(17, Month.July, 2008), 0.0278625);
       
         final Schedule floatingBondSchedule = new Schedule(
                     new Date(21, Month.October, 2005),
                     new Date(21, Month.October, 2010), new Period(Frequency.Quarterly),
                     new UnitedStates(UnitedStates.Market.NYSE),
View Full Code Here

                new USDCurrency(),
                new Target(),
                new Period(6,TimeUnit.Months),
                BusinessDayConvention.ModifiedFollowing,
                new Thirty360(Thirty360.Convention.BondBasis),
                new USDLibor(new Period(3,TimeUnit.Months), h)
                   
                );
        }
View Full Code Here

            final Interpolator interpolator,
            /*@Real*/ final double tolerance) {
     
        // re-adjust settlement
        vars.calendar = new JointCalendar(new BMAIndex().fixingCalendar(),
                                          new USDLibor(new Period(3, TimeUnit.Months)).fixingCalendar(),
                                          JointCalendarRule.JoinHolidays);
        vars.today = vars.calendar.adjust(Date.todaysDate());
        new Settings().setEvaluationDate(vars.today);
        vars.settlement = vars.calendar.advance(vars.today, vars.settlementDays, TimeUnit.Days);


        final Handle<YieldTermStructure> riskFreeCurve = new Handle<YieldTermStructure>(new FlatForward(vars.settlement, 0.04, new Actual360()));

        final BMAIndex bmaIndex = new BMAIndex();
        final IborIndex liborIndex = new USDLibor(new Period(3, TimeUnit.Months), riskFreeCurve);
        for (int i=0; i<vars.bmas; ++i) {
            final Handle<Quote> f = new Handle<Quote>(vars.fractions[i]);
            vars.bmaHelpers[i] = // boost::shared_ptr<RateHelper>(
                      new BMASwapRateHelper(f, new Period(bmaData[i].n, bmaData[i].units),
                                            vars.settlementDays,
                                            vars.calendar,
                                            new Period(vars.bmaFrequency),
                                            vars.bmaConvention,
                                            vars.bmaDayCounter,
                                            bmaIndex,
                                            liborIndex);
        }

        final Weekday w = vars.today.weekday();
        final Date lastWednesday = (w.ordinal() >= 4) ? vars.today.sub(w.ordinal() - 4) : vars.today.add(4 - w.ordinal() - 7);
        final Date lastFixing = bmaIndex.fixingCalendar().adjust(lastWednesday);
        bmaIndex.addFixing(lastFixing, 0.03);

        vars.termStructure = new PiecewiseYieldCurve<T,I,B>(
                      classT, classI, classB,
                      vars.settlement, vars.bmaHelpers,
                                    new Actual360(),
                                    new Handle/*<Quote>*/[0],
                                    new Date[0],
                                    1.0e-12,
                                    interpolator);

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

        // check BMA swaps
        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())
                                      .backwards()
                                      .schedule();


            final BMASwap swap = new BMASwap(BMASwap.Type.Payer, 100.0,
                               liborSchedule, 0.75, 0.0,
                               libor3m, libor3m.dayCounter(),
                               bmaSchedule, bma, vars.bmaDayCounter);
            swap.setPricingEngine(new DiscountingSwapEngine(libor3m.termStructure()));

            /*@Real*/ final double expectedFraction = bmaData[i].rate/100;
            /*@Real*/ final double estimatedFraction = swap.fairLiborFraction();
            /*@Real*/ final double error = Math.abs(expectedFraction-estimatedFraction);
            if (error > tolerance) {
View Full Code Here

      final int settlementDays = 1;

    final Handle<YieldTermStructure> riskFreeRate = new Handle<YieldTermStructure>(Utilities.flatRate(today, 0.025, new Actual360()));
    final Handle<YieldTermStructure> discountCurve = new Handle<YieldTermStructure>(Utilities.flatRate(today, 0.03, new Actual360()));

    final IborIndex index = new USDLibor(new Period(6,TimeUnit.Months), riskFreeRate);
      final int fixingDays = 1;

      final double tolerance = 1.0e-6;

      final IborCouponPricer pricer = new BlackIborCouponPricer(new Handle<OptionletVolatilityStructure>());
View Full Code Here

TOP

Related Classes of org.jquantlib.indexes.ibor.USDLibor

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.