Package org.jquantlib.math.distributions

Examples of org.jquantlib.math.distributions.CumulativeNormalDistribution.op()


                lambda = Math.sqrt( mu * mu - 2.0 * Math.log(discount) / variance);
            }
            D1 = log_H_S / stdDev + lambda * stdDev;
            D2 = D1 - 2.0 * lambda * stdDev;
            final CumulativeNormalDistribution f = new CumulativeNormalDistribution();
            cum_d1 = f.op(D1);
            cum_d2 = f.op(D2);
            n_d1 = f.derivative(D1);
            n_d2 = f.derivative(D2);
        } else {
            // TODO: not tested yet
View Full Code Here


            }
            D1 = log_H_S / stdDev + lambda * stdDev;
            D2 = D1 - 2.0 * lambda * stdDev;
            final CumulativeNormalDistribution f = new CumulativeNormalDistribution();
            cum_d1 = f.op(D1);
            cum_d2 = f.op(D2);
            n_d1 = f.derivative(D1);
            n_d2 = f.derivative(D2);
        } else {
            // TODO: not tested yet
            mu = Math.log(dividendDiscount / discount) / variance - 0.5;
View Full Code Here

        @Real final double d2 = d1 - stddev;

        // TODO: code review
        final CumulativeNormalDistribution phi = new CumulativeNormalDistribution();
        @Real final double result = discount * optionType.toInteger()
        * (forward * phi.op(optionType.toInteger() * d1) - strike * phi.op(optionType.toInteger() * d2));

        if (result >= 0.0) return result;
        throw new ArithmeticException("a negative value was calculated"); // TODO: message
    }

View Full Code Here

        @Real final double d2 = d1 - stddev;

        // TODO: code review
        final CumulativeNormalDistribution phi = new CumulativeNormalDistribution();
        @Real final double result = discount * optionType.toInteger()
        * (forward * phi.op(optionType.toInteger() * d1) - strike * phi.op(optionType.toInteger() * d2));

        if (result >= 0.0) return result;
        throw new ArithmeticException("a negative value was calculated"); // TODO: message
    }

View Full Code Here

        final double d1 = Math.log((forward+displacement)/(strike+displacement))/stddev + 0.5*stddev;
        final double d2 = d1 - stddev;

        // TODO: code review
        final CumulativeNormalDistribution phi = new CumulativeNormalDistribution();
        return phi.op(optionType.toInteger() * d2);
    }

    // ---
    // ---
    // ---
View Full Code Here

        if (stddev == 0.0) return discount * Math.max(d, 0.0);

        // TODO: code review
        final CumulativeNormalDistribution phi = new CumulativeNormalDistribution();
        @NonNegative
        final double result = discount * stddev * phi.derivative(h) + d * phi.op(h);
        if (result >= 0.0) return result;
        throw new ArithmeticException("negative value");
    }

    // ---
View Full Code Here

        if (variance >= Math.E) {
            D1 = log_H_S / stdDev + mu * stdDev;
            D2 = D1 - 2.0 * mu * stdDev;
            final CumulativeNormalDistribution f = new CumulativeNormalDistribution();
            cum_d1 = f.op(D1);
            cum_d2 = f.op(D2);
            n_d1 = f.derivative(D1);
            n_d2 = f.derivative(D2);
        } else {
            if (log_H_S > 0) {
View Full Code Here

        if (variance >= Math.E) {
            D1 = log_H_S / stdDev + mu * stdDev;
            D2 = D1 - 2.0 * mu * stdDev;
            final CumulativeNormalDistribution f = new CumulativeNormalDistribution();
            cum_d1 = f.op(D1);
            cum_d2 = f.op(D2);
            n_d1 = f.derivative(D1);
            n_d2 = f.derivative(D2);
        } else {
            if (log_H_S > 0) {
                cum_d1 = 1.0;
View Full Code Here

                cum_d2 = 1.0;
            } else {
                D1 = Math.log(forward / strike) / stdDev + 0.5 * stdDev;
                D2 = D1 - stdDev;
                final CumulativeNormalDistribution f = new CumulativeNormalDistribution();
                cum_d1 = f.op(D1);
                cum_d2 = f.op(D2);
                n_d1 = f.derivative(D1);
                n_d2 = f.derivative(D2);
            }
        } else {
View Full Code Here

            } else {
                D1 = Math.log(forward / strike) / stdDev + 0.5 * stdDev;
                D2 = D1 - stdDev;
                final CumulativeNormalDistribution f = new CumulativeNormalDistribution();
                cum_d1 = f.op(D1);
                cum_d2 = f.op(D2);
                n_d1 = f.derivative(D1);
                n_d2 = f.derivative(D2);
            }
        } else {
            if (forward > strike) {
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.