Package org.jquantlib

Examples of org.jquantlib.Settings$DateProxy


        (coupon_.accrualPeriod()*discount_);
    }

    public double optionletPrice(final Option.Type optionType, final double effStrike)  {
        final Date fixingDate = coupon_.fixingDate();
        if (fixingDate.le(new Settings().evaluationDate())) {
            // the amount is determined
            double a, b;
            if (optionType==Option.Type.Call) {
                a = coupon_.indexFixing();
                b = effStrike;
View Full Code Here


                dayCounter, isInArrears);
    }

    @Override
    public double indexFixing() {
        final Settings settings = new Settings();
        if (settings.isUseIndexedCoupon())
            return index_.fixing(fixingDate());
        if (isInArrears())
            return index_.fixing(fixingDate());
        else {
            final Handle<YieldTermStructure> termStructure = index_.termStructure();
            QL.require(termStructure != null , NULL_TERM_STRUCTURE)// QA:[RG]::verified
            final Date today = settings.evaluationDate();
            final Date fixing_date = fixingDate();
            final IndexManager indexManager = IndexManager.getInstance();
            if (fixing_date.lt(today)) {
                final double pastFixing = indexManager.get (index_.name()).get(fixing_date);
                QL.require(!Double.isNaN(pastFixing), "Missing fixing"); // TODO: message
View Full Code Here

     */
    public double npv(final Leg cashflows, final InterestRate irr, final Date settlementDate) {

        Date date = settlementDate;
        if (date.isNull()) {
            date = new Settings().evaluationDate();
        }

        final YieldTermStructure flatRate = new FlatForward(date, irr.rate(), irr.dayCounter(), irr.compounding(), irr.frequency());
        return npv(cashflows, new Handle<YieldTermStructure>(flatRate), date, date, 0);
    }
View Full Code Here

     */

    public double bps (final Leg cashflows, final Handle <YieldTermStructure> discountCurve)
    {
        // default variable of settlement date
        return bps (cashflows, discountCurve, new Settings().evaluationDate());
    }
View Full Code Here

     * according to the given term structure.
     */
    public double bps(final Leg cashflows, final InterestRate irr, Date settlementDate){
        if (settlementDate.isNull())
        {
            settlementDate = new Settings().evaluationDate();
        }
        final YieldTermStructure flatRate = new FlatForward(settlementDate, irr.rate(),
                    irr.dayCounter(), irr.compounding(), irr.frequency());
        return bps(cashflows, new Handle<YieldTermStructure>(flatRate), settlementDate, settlementDate);
     }
View Full Code Here

            final Frequency frequency, final Date settlementDate, final double tolerance, final int maxIterations,
            final double guess) {

        Date date = settlementDate;
        if (date.isNull()) {
            date = new Settings().evaluationDate();
        }

        // depending on the sign of the market price, check that cash
        // flows of the opposite sign have been specified (otherwise
        // IRR is nonsensical.)
View Full Code Here

     */
    public double duration(final Leg leg, final InterestRate y, final Duration duration, final Date settlementDate) {

        Date date = settlementDate;
        if (date.isNull()) {
            date = new Settings().evaluationDate();
        }

        switch (duration) {
        case Simple:
            return simpleDuration(leg, y, date);
View Full Code Here

     */
    public double convexity(final Leg cashFlows, final InterestRate rate, final Date settlementDate) {

        Date date = settlementDate;
        if (date.isNull()) {
            date = new Settings().evaluationDate();
        }

        final DayCounter dayCounter = rate.dayCounter();

        double P = 0.0;
View Full Code Here

        return previousCashFlow(leg, new Date());
    }

    final public int previousCashFlow(final Leg leg, Date refDate) {
        if (refDate.isNull()) {
            refDate = new Settings().evaluationDate();
        }

        if (!(leg.get(0).hasOccurred(refDate)))
            return leg.size();
View Full Code Here

     * @param settlement
     * @return
     */
    final public CashFlow nextCashFlow(final Leg cashFlows, Date settlement) {
        if (settlement.isNull()) {
            settlement = new Settings().evaluationDate();
        }
        for (int i = 0; i < cashFlows.size(); ++i) {
            // the first coupon paying after d is the one we're after
            if (!cashFlows.get(i).hasOccurred(settlement))
                return cashFlows.get(i);
View Full Code Here

TOP

Related Classes of org.jquantlib.Settings$DateProxy

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.