Package org.jquantlib.lang.exceptions

Examples of org.jquantlib.lang.exceptions.LibraryException


        // instantiate a generic RandomNumberGenerator
        try {
            this.rng = (RNG) TypeToken.getClazz(this.getClass()).getConstructor(long.class).newInstance(seed);
        } catch (final Exception e) {
            throw new LibraryException(e); // QA:[RG]::verified
        }
    }
View Full Code Here


            case UpIn:
            case DownOut:
            case UpOut:
              break;
            default:
                throw new LibraryException(UNKNOWN_TYPE); // QA:[RG]::verified
          }

          QL.require(!Double.isNaN(barrier), "no barrier given"); // TODO: message
          QL.require(!Double.isNaN(rebate), "no rebate given"); // TODO: message
        }
View Full Code Here

            if (Closeness.isCloseEnough(x, 1.0)) {
                x = 1.0;
            } else if (Math.abs(x) < Constants.QL_EPSILON) {
                x = 0.0;
            } else {
                throw new LibraryException(SIGMA_MUST_BE_POSITIVE); // QA:[RG]::verified
            }
        }

        if (x < xlow) {
            // Rational approximation for the lower region 0<x<u_low
View Full Code Here

                return underlying < a.barrier;
              case UpIn:
              case UpOut:
                return underlying > a.barrier;
              default:
                throw new LibraryException("Unknown type"); // TODO: message
            }
        }
View Full Code Here

                break;
            case American:
                engine = new FDDividendAmericanEngine(newProcess);
                break;
            case Bermudan:
                throw new LibraryException("engine not available for Bermudan option with dividends"); // TODO: message
            default:
                throw new LibraryException("unknown exercise type"); // // TODO: message
        }

        return ImpliedVolatilityHelper.calculate(
                this,
                engine,
View Full Code Here

                dy = (mu - rhov_ / sigmav_ * kappav_ * (thetav_ - vol * vol)) * dt + vol * sqrhov_ * dw0 * sdt;

                retVal[0] = x00 * Math.exp(dy + rhov_ / sigmav_ * (retVal[1] - x01));
                break;
            default:
                throw new LibraryException("unknown discretization schema"); // QA:[RG]::verified // TODO: message
        }

        return new Array( retVal );
    }
View Full Code Here

        if (settlement.isNull()){
            settlement = settlementDate();
        }

        if (engine==null)
            throw new LibraryException("null pricing engine"); //// TODO: message
        //FIXME: DiscontingBondEngine
        QL.require(DiscountingBondEngine.class.isAssignableFrom(engine.getClass()), ReflectConstants.WRONG_ARGUMENT_TYPE); // QA:[RG]::verified
        final DiscountingBondEngine discountingBondEngine = (DiscountingBondEngine)engine;

        return dirtyPriceFromZSpreadFunction(notional(settlement), cashflows_,
View Full Code Here

                break;
            case Geometric:
                QL.require(runningAccumulator > 0.0 , "positive running product required: not allowed"); // QA:[RG]::verified // TODO: message
                break;
            default:
                throw new LibraryException("invalid average type"); // QA:[RG]::verified // TODO: message
            }
        }
View Full Code Here

            break;
          case Bermudan:
            engine = new FDBermudanEngine(newProcess);
            break;
          default:
            throw new LibraryException(UNKNOWN_EXERCISE_TYPE);
        }

        return ImpliedVolatilityHelper.calculate(this,
                                                 engine,
                                                 volQuote,
View Full Code Here

                case Call:
                    return Math.max(discountS - strike, 0);
                case Put:
                    return Math.max(strike - discountS, 0);
                default:
                    throw new LibraryException(Option.Type.UNKNOWN_OPTION_TYPE);
            }
        final double sigma2 = sigma() * sigma();
        final double h = Math.sqrt(k() * k() + 2 * sigma2);
        final double r0 = termstructureConsistentModel.termStructure().currentLink().forwardRate(0.0, 0.0, Compounding.Continuous,
                Frequency.NoFrequency).rate();
View Full Code Here

TOP

Related Classes of org.jquantlib.lang.exceptions.LibraryException

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.