Examples of NPV()


Examples of org.jquantlib.instruments.DividendVanillaOption.NPV()

                                /* @Volatility */ spot.setValue(u);
                                qRate.setValue(q);
                                rRate.setValue(r);
                                vol.setValue(v);

                                /* @Real */ final double calculated = option.NPV();
                                /* @Real */ final double expected = ref_option.NPV();
                                /* @Real */ final double error = Math.abs(calculated-expected);
                                if (error > tolerance)
                                    REPORT_FAILURE("value", payoff, exercise,
                                                   u, q, r, today, v,
View Full Code Here

Examples of org.jquantlib.instruments.DividendVanillaOption.NPV()

                                spot.setValue(u);
                                qRate.setValue(q);
                                rRate.setValue(r);
                                vol.setValue(v);

                                /* @Real */ final double value = option.NPV();
                                calculated.put("delta", option.delta());
                                calculated.put("gamma", option.gamma());
                                calculated.put("theta", option.theta());
                                calculated.put("rho",   option.rho());
                                calculated.put("vega",  option.vega());
View Full Code Here

Examples of org.jquantlib.instruments.DividendVanillaOption.NPV()

                                if (value > spot.value()*1.0e-5) {
                                    // perturb spot and get delta and gamma
                                    /* @Real */ final double du = u*1.0e-4;
                                    spot.setValue(u+du);
                                    /* @Real */ double value_p = option.NPV();
                                    final double delta_p = option.delta();
                                    spot.setValue(u-du);
                                    /* @Real */ double value_m = option.NPV();
                                    final double delta_m = option.delta();
                                    spot.setValue(u);
View Full Code Here

Examples of org.jquantlib.instruments.DividendVanillaOption.NPV()

                                    /* @Real */ final double du = u*1.0e-4;
                                    spot.setValue(u+du);
                                    /* @Real */ double value_p = option.NPV();
                                    final double delta_p = option.delta();
                                    spot.setValue(u-du);
                                    /* @Real */ double value_m = option.NPV();
                                    final double delta_m = option.delta();
                                    spot.setValue(u);
                                    expected.put("delta", (value_p - value_m)/(2*du) );
                                    expected.put("gamma", (delta_p - delta_m)/(2*du) );

View Full Code Here

Examples of org.jquantlib.instruments.DividendVanillaOption.NPV()

                                    expected.put("gamma", (delta_p - delta_m)/(2*du) );

                                    // perturb risk-free /* @Rate */ double and get rho
                                    final /* @Spread */ double dr = r*1.0e-4;
                                    rRate.setValue(r+dr);
                                    value_p = option.NPV();
                                    rRate.setValue(r-dr);
                                    value_m = option.NPV();
                                    rRate.setValue(r);
                                    expected.put("rho", (value_p - value_m)/(2*dr) );

View Full Code Here

Examples of org.jquantlib.instruments.DividendVanillaOption.NPV()

                                    // perturb risk-free /* @Rate */ double and get rho
                                    final /* @Spread */ double dr = r*1.0e-4;
                                    rRate.setValue(r+dr);
                                    value_p = option.NPV();
                                    rRate.setValue(r-dr);
                                    value_m = option.NPV();
                                    rRate.setValue(r);
                                    expected.put("rho", (value_p - value_m)/(2*dr) );

                                    // perturb /* @Volatility */ double and get vega
                                    final /* @Spread */ double dv = v*1.0e-4;
 
View Full Code Here

Examples of org.jquantlib.instruments.DividendVanillaOption.NPV()

                                    expected.put("rho", (value_p - value_m)/(2*dr) );

                                    // perturb /* @Volatility */ double and get vega
                                    final /* @Spread */ double dv = v*1.0e-4;
                                    vol.setValue(v+dv);
                                    value_p = option.NPV();
                                    vol.setValue(v-dv);
                                    value_m = option.NPV();
                                    vol.setValue(v);
                                    expected.put("vega", (value_p - value_m)/(2*dv) );

View Full Code Here

Examples of org.jquantlib.instruments.DividendVanillaOption.NPV()

                                    // perturb /* @Volatility */ double and get vega
                                    final /* @Spread */ double dv = v*1.0e-4;
                                    vol.setValue(v+dv);
                                    value_p = option.NPV();
                                    vol.setValue(v-dv);
                                    value_m = option.NPV();
                                    vol.setValue(v);
                                    expected.put("vega", (value_p - value_m)/(2*dv) );

                                    // perturb date and get theta
                                    final /*@Time*/ double dT = dc.yearFraction(today.sub(1), today.add(1));
View Full Code Here

Examples of org.jquantlib.instruments.DividendVanillaOption.NPV()

                                    expected.put("vega", (value_p - value_m)/(2*dv) );

                                    // perturb date and get theta
                                    final /*@Time*/ double dT = dc.yearFraction(today.sub(1), today.add(1));
                                    new Settings().setEvaluationDate(today.sub(1));
                                    value_m = option.NPV();
                                    new Settings().setEvaluationDate(today.add(1));
                                    value_p = option.NPV();
                                    new Settings().setEvaluationDate(today);
                                    expected.put("theta", (value_p - value_m)/dT );

View Full Code Here

Examples of org.jquantlib.instruments.DividendVanillaOption.NPV()

                                    // perturb date and get theta
                                    final /*@Time*/ double dT = dc.yearFraction(today.sub(1), today.add(1));
                                    new Settings().setEvaluationDate(today.sub(1));
                                    value_m = option.NPV();
                                    new Settings().setEvaluationDate(today.add(1));
                                    value_p = option.NPV();
                                    new Settings().setEvaluationDate(today);
                                    expected.put("theta", (value_p - value_m)/dT );

                                    // compare
                                    for (final Map.Entry<String, Double> it : calculated.entrySet()) {
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.