Package org.jquantlib.daycounters

Examples of org.jquantlib.daycounters.DayCounter


        greeks.delta = black.delta(spot);
        moreGreeks.deltaForward = black.deltaForward();
        moreGreeks.elasticity = black.elasticity(spot);
        greeks.gamma = black.gamma(spot);

        final DayCounter rfdc = process.riskFreeRate().currentLink().dayCounter();
        final DayCounter divdc = process.dividendYield().currentLink().dayCounter();
        final DayCounter voldc = process.blackVolatility().currentLink().dayCounter();
        final Date refDate = process.riskFreeRate().currentLink().referenceDate();
        /* @Time */double t = rfdc.yearFraction(refDate, a.exercise.lastDate());
        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


        final PlainVanillaPayoff payoff = (PlainVanillaPayoff)arguments.payoff;

        /*@Volatility*/ final double volatility = process.blackVolatility().currentLink().blackVol(exercise, payoff.strike());
        /*@Real*/ final double variance = process.blackVolatility().currentLink().blackVariance(exercise, payoff.strike());
        /*@DiscountFactor*/ final double  riskFreeDiscount = process.riskFreeRate().currentLink().discount(exercise);
        final DayCounter rfdc  = process.riskFreeRate().currentLink().dayCounter();
        final DayCounter divdc = process.dividendYield().currentLink().dayCounter();
        final DayCounter voldc = process.blackVolatility().currentLink().dayCounter();

        /*@Spread*/ final double dividendYield = 0.5 * (
                process.riskFreeRate().currentLink().zeroRate(
                        exercise,
                        rfdc,
                        Compounding.Continuous,
                        Frequency.NoFrequency).rate() + process.dividendYield().currentLink().zeroRate(
                                exercise,
                                divdc,
                                Compounding.Continuous,
                                Frequency.NoFrequency).rate() + volatility*volatility/6.0);

        /*@Time*/ final double t_q = divdc.yearFraction(
                process.dividendYield().currentLink().referenceDate(), exercise);
        /*@DiscountFactor*/ final double dividendDiscount = Math.exp(-dividendYield*t_q);
        /*@Real*/ final double spot = process.stateVariable().currentLink().value();
        QL.require(spot > 0.0, "negative or null underlying given"); // QA:[RG]::verified // TODO: message
        /*@Real*/ final double forward = spot * dividendDiscount / riskFreeDiscount;

        final BlackCalculator black = new BlackCalculator(payoff, forward, Math.sqrt(variance/3.0),riskFreeDiscount);
        r.value = black.value();
        greeks.delta = black.delta(spot);
        greeks.gamma = black.gamma(spot);
        greeks.dividendRho = black.dividendRho(t_q)/2.0;

        /*@Time*/ final double t_r = rfdc.yearFraction(process.riskFreeRate().currentLink().referenceDate(),
                a.exercise.lastDate());
        greeks.rho = black.rho(t_r) + 0.5 * black.dividendRho(t_q);

        /*@Time*/ final double t_v = voldc.yearFraction(
                process.blackVolatility().currentLink().referenceDate(),
                a.exercise.lastDate());
        greeks.vega = black.vega(t_v)/Math.sqrt(3.0) +
        black.dividendRho(t_q)*volatility/6.0;

 
View Full Code Here

        /* @Real */final double underlyings[] = { 100.0 };
        /* @Rate */final double qRates[] = { 0.00, 0.05 };
        /* @Rate */final double rRates[] = { 0.01, 0.05, 0.15 };
        /* @Volatility */final double vols[] = { 0.11, 0.50, 1.20 };

        final DayCounter dc = new Actual360();
        final Date today = Date.todaysDate();

        final SimpleQuote spot = new SimpleQuote(0.0);
        final SimpleQuote vol = new SimpleQuote(0.0);
        final BlackVolTermStructure volTS = Utilities.flatVol(today, vol, dc);
View Full Code Here

     * @warning term structures initialized by means of this
     *          constructor must manage their own reference date
     *          by overriding the referenceDate() method.
     */
    public BlackVolatilityTermStructure() {
        super(new Calendar(), BusinessDayConvention.Following, new DayCounter());
    }
View Full Code Here

     * @warning term structures initialized by means of this
     *          constructor must manage their own reference date
     *          by overriding the referenceDate() method.
     */
    public BlackVolatilityTermStructure(final Calendar cal) {
        super(cal, BusinessDayConvention.Following, new DayCounter());
    }
View Full Code Here

     * @warning term structures initialized by means of this
     *          constructor must manage their own reference date
     *          by overriding the referenceDate() method.
     */
    public BlackVolatilityTermStructure(final Calendar cal, final BusinessDayConvention bdc) {
        super(cal, bdc, new DayCounter());
    }
View Full Code Here

    /**
     * Initialize with a fixed reference date
     */
    public BlackVolatilityTermStructure(final Date referenceDate) {
        super(referenceDate, new Calendar(), BusinessDayConvention.Following, new DayCounter());
    }
View Full Code Here

     * Initialize with a fixed reference date
     */
    public BlackVolatilityTermStructure(
            final Date referenceDate,
            final Calendar cal) {
        super(referenceDate, cal, BusinessDayConvention.Following, new DayCounter());
    }
View Full Code Here

     */
    public BlackVolatilityTermStructure(
            final Date referenceDate,
            final Calendar cal,
            final BusinessDayConvention bdc) {
        super(referenceDate, cal, bdc, new DayCounter());
    }
View Full Code Here

     * Calculate the reference date based on the global evaluation date
     */
    public BlackVolatilityTermStructure(
            /*@Natural*/ final int settlementDays,
            final Calendar cal) {
        super(settlementDays, cal, BusinessDayConvention.Following, new DayCounter());
    }
View Full Code Here

TOP

Related Classes of org.jquantlib.daycounters.DayCounter

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.