Package org.jquantlib.termstructures.volatilities

Examples of org.jquantlib.termstructures.volatilities.Sabr


        final double initialBeta = 0.6;
        final double initialNu = 0.02;
        final double initialRho = 0.01;
        // calculate SABR vols and compare with input vols
        for (int i=0; i<strikes.length; i++) {
            final double calculatedVol = (new Sabr()).sabrVolatility(strikes[i], forward, expiry,
                                                initialAlpha, initialBeta,
                                                initialNu, initialRho);
            assertFalse("failed to reproduce expected datum"
                    +"\n    expected value:   "+volatilities[i]
                    +"\n    calculated value: "+calculatedVol
View Full Code Here


      if (!Double.isNaN(rho_)) {
                rhoIsFixed_ = rhoIsFixed;
            } else {
                rho_ = 0.0;
            }
      (new Sabr()).validateSabrParameters(alpha_, beta_, nu_, rho_);
    }
View Full Code Here

    }

    @Override
        public double op(final double x) {
      QL.require(x > 0.0, "strike must be positive: " + x + " not allowed");
      return (new Sabr()).sabrVolatility(x, forward_, itsCoeffs.t_, itsCoeffs.alpha_, itsCoeffs.beta_, itsCoeffs.nu_, itsCoeffs.rho_);
    }
View Full Code Here

        final double initialBeta = 0.6;
        final double initialNu = 0.02;
        final double initialRho = 0.01;
        // calculate SABR vols and compare with input vols
        for (int i=0; i<strikes.length; i++) {
            final double calculatedVol = (new Sabr()).sabrVolatility(strikes[i], forward, expiry,
                                                initialAlpha, initialBeta,
                                                initialNu, initialRho);
            assertFalse("failed to reproduce expected datum"
                    +"\n    expected value:   "+volatilities[i]
                    +"\n    calculated value: "+calculatedVol
View Full Code Here

        final double alpha = 0.0305473;
        final double beta = 0.5;
        final double nu = 0.34;
        final double rho = -0.11;

        final Sabr sabr = new Sabr();
        double sabrVol = sabr.sabrVolatility(strike, forward, expiryTime, alpha, beta, nu, rho);
        assertEquals(0.16,sabrVol, 1.0e-6);

        strike = 0.0598;
        sabrVol = sabr.sabrVolatility(strike, forward, expiryTime, alpha, beta, nu, rho);
        assertEquals(0.15755519,sabrVol, 1.0e-6);

        strike = 0.0198;
        sabrVol = sabr.sabrVolatility(strike, forward, expiryTime, alpha, beta, nu, rho);
        assertEquals(0.2373848,sabrVol, 1.0e-6);

  }
View Full Code Here

        final double initialBeta = 0.6;
        final double initialNu = 0.02;
        final double initialRho = 0.01;
        // calculate SABR vols and compare with input vols
        for(int i=0; i < strikes.length; i++){
            final double calculatedVol = (new Sabr()).sabrVolatility(strikes[i], forward, expiry,
                                                        initialAlpha, initialBeta,
                                                        initialNu, initialRho);
          assertFalse("failed to calculate Sabr function at strike " + strikes[i]
                      + "\n    expected:   " + volatilities[i]
                      + "\n    calculated: " + calculatedVol
View Full Code Here

      if (!Double.isNaN(rho_)) {
                rhoIsFixed_ = rhoIsFixed;
            } else {
                rho_ = 0.0;
            }
      (new Sabr()).validateSabrParameters(alpha_, beta_, nu_, rho_);
    }
View Full Code Here

    }

    @Override
        public double op(final double x) {
      QL.require(x > 0.0, "strike must be positive: " + x + " not allowed");
      return (new Sabr()).sabrVolatility(x, forward_, itsCoeffs.t_, itsCoeffs.alpha_, itsCoeffs.beta_, itsCoeffs.nu_, itsCoeffs.rho_);
    }
View Full Code Here

TOP

Related Classes of org.jquantlib.termstructures.volatilities.Sabr

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.