Examples of discount()


Examples of org.jquantlib.termstructures.yieldcurves.FlatForward.discount()

        final Date date40 = today.clone().addAssign(40);
        final Date date50 = today.clone().addAssign(50);


        //Calculating discount factor
        System.out.println("The discount factor for the date 30 days from today is = "+flatforward.discount(date30.clone()));

        //Calculating forward rate
        System.out.println("The forward rate between the date 30 days from today to 50 days from today is = "+flatforward.forwardRate(date30.clone(), date50.clone(), new Actual365Fixed(), Compounding.Continuous).rate());

        //Calculating parRate for the dates as shown below-
View Full Code Here

Examples of org.jquantlib.termstructures.yieldcurves.FlatForward.discount()

        final Date today = new Settings().evaluationDate();

        for (int i=0; i<days.length; i++) {
            final Date anotherDay = today.add(days[i]);
            expected[i] = localTermStructure.discount(anotherDay);
        }

        final Date nextMonth = today.add(30);
        new Settings().setEvaluationDate(nextMonth);
        /*@DiscountFactor*/ final double[] calculated = new /*@DiscountFactor*/ double[days.length];
View Full Code Here

Examples of org.jquantlib.termstructures.yieldcurves.FlatForward.discount()

        new Settings().setEvaluationDate(nextMonth);
        /*@DiscountFactor*/ final double[] calculated = new /*@DiscountFactor*/ double[days.length];

        for (int i=0; i<days.length; i++) {
            final Date anotherDay = nextMonth.add(days[i]);
            calculated[i] = localTermStructure.discount(anotherDay);
        }

        for (int i=0; i<days.length; i++) {
            if (!Closeness.isClose(expected[i],calculated[i])) {
                fail("\n  Discount at " + days[i] + " days:\n"
View Full Code Here

Examples of org.jquantlib.termstructures.yieldcurves.ForwardRateStructure.discount()

        final RelinkableHandle<Quote>  handleToSpreadRateQuote = new RelinkableHandle<Quote>(spreadRateQuote);

        final ForwardRateStructure forwardSpreadedTermStructure = new ForwardSpreadedTermStructure(new RelinkableHandle<YieldTermStructure>(flatforward),handleToSpreadRateQuote);

        //Calculating discount factor.This termstructure adds the spread as specified by the spread quote and then calculates the discount.
        System.out.println("The discount factor for the date 30 days from today is = "+forwardSpreadedTermStructure.discount(date30.clone()));

        //Calculating forward rate.This termstructure adds the spread as specified by the spread quote and then calculates the discount.
        System.out.println("The forward rate between the date 30 days from today to 50 days from today is = "+forwardSpreadedTermStructure.forwardRate(date30.clone(), date50.clone(), new Actual365Fixed(), Compounding.Continuous).rate());

        //Calculating parRate for the dates(as used in the FlatForward case) as shown below-
View Full Code Here

Examples of org.jquantlib.termstructures.yieldcurves.ForwardSpreadedTermStructure.discount()

        final RelinkableHandle<Quote>  handleToSpreadRateQuote = new RelinkableHandle<Quote>(spreadRateQuote);

        final ForwardRateStructure forwardSpreadedTermStructure = new ForwardSpreadedTermStructure(new RelinkableHandle<YieldTermStructure>(flatforward),handleToSpreadRateQuote);

        //Calculating discount factor.This termstructure adds the spread as specified by the spread quote and then calculates the discount.
        System.out.println("The discount factor for the date 30 days from today is = "+forwardSpreadedTermStructure.discount(date30.clone()));

        //Calculating forward rate.This termstructure adds the spread as specified by the spread quote and then calculates the discount.
        System.out.println("The forward rate between the date 30 days from today to 50 days from today is = "+forwardSpreadedTermStructure.forwardRate(date30.clone(), date50.clone(), new Actual365Fixed(), Compounding.Continuous).rate());

        //Calculating parRate for the dates(as used in the FlatForward case) as shown below-
View Full Code Here

Examples of org.jquantlib.termstructures.yieldcurves.ZeroSpreadedTermStructure.discount()

            if (cashflows.get(i).hasOccurred(settlement)) {
                continue;
            }
            final Date couponDate = cashflows.get(i).date();
            /* @Real */final double amount = cashflows.get(i).amount();
            price += amount * spreadedCurve.discount(couponDate);
        }
        price /= spreadedCurve.discount(settlement);
        return price / faceAmount * 100.0;
    }

View Full Code Here

Examples of org.jquantlib.termstructures.yieldcurves.ZeroSpreadedTermStructure.discount()

            }
            final Date couponDate = cashflows.get(i).date();
            /* @Real */final double amount = cashflows.get(i).amount();
            price += amount * spreadedCurve.discount(couponDate);
        }
        price /= spreadedCurve.discount(settlement);
        return price / faceAmount * 100.0;
    }



View Full Code Here

Examples of org.jquantlib.termstructures.yieldcurves.ZeroSpreadedTermStructure.discount()

            if (cashflows.get(i).hasOccurred(settlement)) {
                continue;
            }
            final Date couponDate = cashflows.get(i).date();
            /* @Real */final double amount = cashflows.get(i).amount();
            price += amount * spreadedCurve.discount(couponDate);
        }
        price /= spreadedCurve.discount(settlement);
        return price / faceAmount * 100.0;
    }

View Full Code Here

Examples of org.jquantlib.termstructures.yieldcurves.ZeroSpreadedTermStructure.discount()

            }
            final Date couponDate = cashflows.get(i).date();
            /* @Real */final double amount = cashflows.get(i).amount();
            price += amount * spreadedCurve.discount(couponDate);
        }
        price /= spreadedCurve.discount(settlement);
        return price / faceAmount * 100.0;
    }



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.