Package org.jquantlib.lang.exceptions

Examples of org.jquantlib.lang.exceptions.LibraryException


                break;
            case JoinBusinessDays:
                sb.append("JoinBusinessDays(");
                break;
            default:
                throw new LibraryException(UNKNOWN_MARKET);
            }

            int count = 0;
            for (final Calendar calendar : calendars) {
                if (count > 0) {
View Full Code Here


                        return false;
                    }
                }
                return true;
            default:
                throw new LibraryException(UNKNOWN_MARKET);
            }
        }
View Full Code Here

                        return false;
                    }
                }
                return true;
            default:
                throw new LibraryException(UNKNOWN_MARKET);
            }
        }
View Full Code Here

            if (amount.currency().equals(source_)) {
                return new Money(amount.value() * rate_, target_);
            } else if (amount.currency().equals(target_)) {
                return new Money(amount.value() / rate_, source_);
            } else {
                throw new LibraryException("exchange rate not applicable"); // QA:[RG]::verified // TODO: message
            }
        case Derived:
            if (amount.currency() == rateChain_.getFirst().source() || amount.currency() == rateChain_.getFirst().target()) {
                return rateChain_.getSecond().exchange(rateChain_.getFirst().exchange(amount));
            } else if (amount.currency() == rateChain_.getSecond().source() || amount.currency() == rateChain_.getSecond().target()) {
                return rateChain_.getFirst().exchange(rateChain_.getSecond().exchange(amount));
            } else {
                throw new LibraryException("exchange rate not applicable"); // QA:[RG]::verified // TODO: message
            }
        default:
            throw new LibraryException("unknown exchange-rate type"); // QA:[RG]::verified // TODO: message
        }
    }
View Full Code Here

        } else if (r1.target_.equals(r2.target_)) {
            result.source_ = r1.source_;
            result.target_ = r2.source_;
            result.rate_ = r1.rate_/r2.rate_;
        } else {
            throw new LibraryException("exchange rates not chainable"); // QA:[RG]::verified // TODO: message
        }
        return result;
    }
View Full Code Here

    public LocalBootstrap(final Class<?> klass, final int localisation, final boolean forcePositive) {
        QL.validateExperimentalMode();

        if (klass==null) {
            throw new LibraryException("null PiecewiseCurve"); // TODO: message
        }
        if (!PiecewiseCurve.class.isAssignableFrom(klass)) {
            throw new LibraryException(ReflectConstants.WRONG_ARGUMENT_TYPE);
        }
        this.classB = klass;

        this.validCurve = false;
        this.ts = null;
View Full Code Here

    public void setup(final PiecewiseCurve ts) {

        QL.ensure (ts != null, "TermStructure cannot be null");
        if (!classB.isAssignableFrom(ts.getClass())) {
            throw new LibraryException(ReflectConstants.WRONG_ARGUMENT_TYPE);
        }

        this.ts            = ts;
        this.interpolator  = ts.interpolator();
        this.interpolation = ts.interpolation();
View Full Code Here

            } else {
                // (1+(r/f))^(f*t)
                return Math.pow((1 + r / freq), (freq * t));
            }
        } else {
            throw new LibraryException("unknown compounding convention"); // QA:[RG]::verified // TODO: message
        }
    }
View Full Code Here

                // rate = (compound^(1/(f*t))-1)*f
                rate = (Math.pow(c, (1 / (f * t))) - 1) * f;
            }
            break;
        default:
            throw new LibraryException("unknown compounding convention"); // QA:[RG]::verified // TODO: message
        }
        return new InterestRate(rate, resultDC, comp, freq);
    }
View Full Code Here

                throw new IllegalArgumentException(freq + " frequency not allowed for this interest rate");
            } else {
                sb.append("simple compounding up to " + (12 / freq) + " months, then " + freq + " compounding");
            }
        } else {
            throw new LibraryException("unknown compounding convention"); // QA:[RG]::verified // TODO: message
        }
        return sb.toString();
    }
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.