Package org.jquantlib.daycounters

Examples of org.jquantlib.daycounters.DayCounter.yearFraction()


            accrualPeriod_.set(i, coupon.accrualPeriod());

            fixingDates_.set(i, coupon.fixingDate());
            fixingTimes_.set(i, dayCounter.yearFraction(startDate, coupon.fixingDate()));
            accrualStartTimes_.set(i, dayCounter.yearFraction(settlement, coupon.accrualStartDate()));
            accrualEndTimes_.set(i, dayCounter.yearFraction(settlement, coupon.accrualEndDate()));
        }
    }


    //
View Full Code Here


        greeks.rho = black.rho(t);

        t = divdc.yearFraction(process.dividendYield().currentLink().referenceDate(), a.exercise.lastDate());
        greeks.dividendRho = black.dividendRho(t);

        t = voldc.yearFraction(process.blackVolatility().currentLink().referenceDate(), a.exercise.lastDate());
        greeks.vega = black.vega(t);
        try {
            greeks.theta = black.theta(spot, t);
            moreGreeks.thetaPerDay = black.thetaPerDay(spot, t);
        } catch (final Exception e) {
View Full Code Here

            greeks.rho = black.rho(t);

            t = divdc.yearFraction(process.dividendYield().currentLink().referenceDate(), a.exercise.lastDate());
            greeks.dividendRho = black.dividendRho(t);

            t = voldc.yearFraction(process.blackVolatility().currentLink().referenceDate(), a.exercise.lastDate());
            greeks.vega            = black.vega(t);
            greeks.theta           = black.theta(spot, t);
            moreGreeks.thetaPerDay = black.thetaPerDay(spot, t);

            moreGreeks.strikeSensitivity  = black.strikeSensitivity();
View Full Code Here

        final double /* @Real */variance = process.blackVolatility().currentLink().blackVariance(A.exercise.lastDate(), 1.0);

        final DayCounter voldc = process.blackVolatility().currentLink().dayCounter();
        final Calendar volcal = process.blackVolatility().currentLink().calendar();
        final Date volRefDate = process.blackVolatility().currentLink().referenceDate();
        final double /* @Time */t = voldc.yearFraction(volRefDate, A.exercise.lastDate());
        final double /* @Rate */riskFreeRate = -Math.log(process.riskFreeRate().currentLink().discount(A.exercise.lastDate())) / t;
        final Date rateRefDate = process.riskFreeRate().currentLink().referenceDate();

        final PoissonDistribution p = new PoissonDistribution(lambda * t);

 
View Full Code Here

       final DayCounter dayCounter = this.process.riskFreeRate().currentLink().dayCounter();
       final Date bondSettlement = this.arguments.settlementDate;

       stoppingTimes = new ArrayList<Double>(this.arguments.exercise.dates().size());
       for (int i=0; i<this.arguments.exercise.dates().size(); ++i)
           stoppingTimes.add(dayCounter.yearFraction(bondSettlement,
                                       this.arguments.exercise.date(i)));

       callabilityTimes = new ArrayList<Double>(this.arguments.callabilityDates.size());
       for (int i=0; i<this.arguments.callabilityDates.size(); ++i)
           callabilityTimes.add(dayCounter.yearFraction(bondSettlement,
View Full Code Here

           stoppingTimes.add(dayCounter.yearFraction(bondSettlement,
                                       this.arguments.exercise.date(i)));

       callabilityTimes = new ArrayList<Double>(this.arguments.callabilityDates.size());
       for (int i=0; i<this.arguments.callabilityDates.size(); ++i)
           callabilityTimes.add(dayCounter.yearFraction(bondSettlement,
                                       this.arguments.callabilityDates.get(i)));

       couponTimes = new ArrayList<Double>(this.arguments.couponDates.size());
       for (int i=0; i<this.arguments.couponDates.size(); ++i)
           couponTimes.add(dayCounter.yearFraction(bondSettlement,
View Full Code Here

           callabilityTimes.add(dayCounter.yearFraction(bondSettlement,
                                       this.arguments.callabilityDates.get(i)));

       couponTimes = new ArrayList<Double>(this.arguments.couponDates.size());
       for (int i=0; i<this.arguments.couponDates.size(); ++i)
           couponTimes.add(dayCounter.yearFraction(bondSettlement,
                                       this.arguments.couponDates.get(i)));

       dividendTimes = new ArrayList<Double>(this.arguments.dividendDates.size());
       for (int i=0; i<this.arguments.dividendDates.size(); ++i)
           dividendTimes.add(dayCounter.yearFraction(bondSettlement,
View Full Code Here

           couponTimes.add(dayCounter.yearFraction(bondSettlement,
                                       this.arguments.couponDates.get(i)));

       dividendTimes = new ArrayList<Double>(this.arguments.dividendDates.size());
       for (int i=0; i<this.arguments.dividendDates.size(); ++i)
           dividendTimes.add(dayCounter.yearFraction(bondSettlement,
                                       this.arguments.dividendDates.get(i)));

       if (!grid.empty()) {
           // adjust times to grid
           for (int i=0; i<stoppingTimes.size(); i++)
View Full Code Here

        for (final Date d = today.add(new Period(6, TimeUnit.Months)); d.lt(exerciseDate); d.addAssign(new Period(6, TimeUnit.Months))) {
            dividends.add(new FixedDividend(1.0, d));
        }

        final DayCounter dayCounter = new Actual365Fixed();
        /*@Time*/ final double maturity = dayCounter.yearFraction(settlementDate,exerciseDate);

        System.out.println("option type = "+type);
        System.out.println("Time to maturity = "+maturity);
        System.out.println("Underlying price = "+underlying);
        System.out.println("Risk-free interest rate = "+riskFreeRate);
View Full Code Here

        // TODO: consider double[] instead
        final List<Double> fixingTimes = new ArrayList<Double>();
        /*@Size*/ int i;
        for (i=0; i<a.fixingDates.size(); i++) {
            if (a.fixingDates.get(i).ge(referenceDate)) {
                /*@Time*/ final double t = voldc.yearFraction(referenceDate,
                        a.fixingDates.get(i));
                fixingTimes.add(Double.valueOf(t));
            }
        }

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.