Class CashFlows
- java.lang.Object
-
- org.jquantlib.cashflow.CashFlows
-
public class CashFlows extends java.lang.ObjectCashflow-analysis functions
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classCashFlows.DurationDuration type
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description doubleatmRate(Leg leg, Handle<YieldTermStructure> discountCurve)doubleatmRate(Leg leg, Handle<YieldTermStructure> discountCurve, Date settlementDate, Date npvDate, int exDividendDays, double npv)At-the-money rate of the cash flows.doublebps(Leg cashflows, Handle<YieldTermStructure> discountCurve)doublebps(Leg cashflows, Handle<YieldTermStructure> discountCurve, Date settlementDate)doublebps(Leg cashflows, Handle<YieldTermStructure> discountCurve, Date settlementDate, Date npvDate)doublebps(Leg cashflows, Handle<YieldTermStructure> discountCurve, Date settlementDate, Date npvDate, int exDividendDays)Basis-point sensitivity of the cash flows.doublebps(Leg cashflows, InterestRate irr, Date settlementDate)Basis-point sensitivity of the cash flows.doubleconvexity(Leg leg, InterestRate y)doubleconvexity(Leg cashFlows, InterestRate rate, Date settlementDate)Cash-flow convexitydoublecouponRate(Leg leg, Leg iteratorLeg, int iteratorIndex)doubleduration(Leg leg, InterestRate y)doubleduration(Leg leg, InterestRate y, CashFlows.Duration duration, Date settlementDate)Cash-flow duration.static CashFlowsgetInstance()doubleirr(Leg leg, double marketPrice, DayCounter dayCounter, Compounding compounding)doubleirr(Leg cashflows, double marketPrice, DayCounter dayCounter, Compounding compounding, Frequency frequency, Date settlementDate, double tolerance, int maxIterations, double guess)Internal rate of return.DatematurityDate(Leg cashflows)CashFlownextCashFlow(Leg cashFlows)CashFlownextCashFlow(Leg cashFlows, Date settlement)NOTE: should return null when no cashflow could be found!intnextCashFlowIndex(Leg cashFlows, Date settlement)NOTE: returns the index! for cashflow.end() the returned index would throw a index out of bounds exceptiondoublenextCouponRate(Leg leg)doublenextCouponRate(Leg cashFlows, Date settlement)doublenpv(Leg leg, Handle<YieldTermStructure> discountCurve)doublenpv(Leg cashflows, Handle<YieldTermStructure> discountCurve, Date settlementDate, Date npvDate)doublenpv(Leg cashflows, Handle<YieldTermStructure> discountCurve, Date settlementDate, Date npvDate, int exDividendDays)NPV of the cash flows.doublenpv(Leg leg, InterestRate interestRate)doublenpv(Leg cashflows, InterestRate irr, Date settlementDate)NPV of the cash flows.intpreviousCashFlow(Leg leg)intpreviousCashFlow(Leg leg, Date refDate)doublepreviousCouponRate(Leg cashFlows)doublepreviousCouponRate(Leg cashFlows, Date settlement)DatestartDate(Leg cashflows)doubleyieldValueBasisPoint(Leg leg, InterestRate y)doubleyieldValueBasisPoint(Leg leg, InterestRate y, Date settlementDate)Yield value of a basis point The yield value of a one basis point change in price is the derivative of the yield with respect to the price multiplied by 0.01
-
-
-
Method Detail
-
getInstance
public static CashFlows getInstance()
-
npv
public double npv(Leg cashflows, Handle<YieldTermStructure> discountCurve, Date settlementDate, Date npvDate)
-
npv
public double npv(Leg cashflows, Handle<YieldTermStructure> discountCurve, Date settlementDate, Date npvDate, int exDividendDays)
NPV of the cash flows.The NPV is the sum of the cash flows, each discounted according to the given term structure.
- Parameters:
cashflows-discountCurve-settlementDate-npvDate-exDividendDays-- Returns:
-
npv
public double npv(Leg leg, Handle<YieldTermStructure> discountCurve)
-
npv
public double npv(Leg cashflows, InterestRate irr, Date settlementDate)
NPV of the cash flows.The NPV is the sum of the cash flows, each discounted according to the given constant interest rate. The result is affected by the choice of the interest-rate compounding and the relative frequency and day counter.
-
npv
public double npv(Leg leg, InterestRate interestRate)
-
bps
public double bps(Leg cashflows, Handle<YieldTermStructure> discountCurve)
-
bps
public double bps(Leg cashflows, Handle<YieldTermStructure> discountCurve, Date settlementDate)
-
bps
public double bps(Leg cashflows, Handle<YieldTermStructure> discountCurve, Date settlementDate, Date npvDate)
-
bps
public double bps(Leg cashflows, Handle<YieldTermStructure> discountCurve, Date settlementDate, Date npvDate, int exDividendDays)
Basis-point sensitivity of the cash flows.The result is the change in NPV due to a uniform 1-basis-point change in the rate paid by the cash flows. The change for each coupon is discounted according to the given term structure.
-
bps
public double bps(Leg cashflows, InterestRate irr, Date settlementDate)
Basis-point sensitivity of the cash flows.The result is the change in NPV due to a uniform 1-basis-point change in the rate paid by the cash flows. The change for each coupon is discounted according to the given term structure.
-
atmRate
public double atmRate(Leg leg, Handle<YieldTermStructure> discountCurve, Date settlementDate, Date npvDate, int exDividendDays, double npv)
At-the-money rate of the cash flows.The result is the fixed rate for which a fixed rate cash flow vector, equivalent to the input vector, has the required NPV according to the given term structure. If the required NPV is not given, the input cash flow vector's NPV is used instead.
-
atmRate
public double atmRate(Leg leg, Handle<YieldTermStructure> discountCurve)
-
irr
public double irr(Leg cashflows, double marketPrice, DayCounter dayCounter, Compounding compounding, Frequency frequency, Date settlementDate, double tolerance, int maxIterations, double guess)
Internal rate of return.The IRR is the interest rate at which the NPV of the cash flows equals the given market price. The function verifies the theoretical existance of an IRR and numerically establishes the IRR to the desired precision.
-
irr
public double irr(Leg leg, double marketPrice, DayCounter dayCounter, Compounding compounding)
-
duration
public double duration(Leg leg, InterestRate y, CashFlows.Duration duration, Date settlementDate)
Cash-flow duration.The simple duration of a string of cash flows is defined as where is the amount of the -th cash flow, is its payment time, and is the corresponding discount according to the passed yield.
The modified duration is defined as where is the present value of the cash flows according to the given IRR .
The Macaulay duration is defined for a compounded IRR as where is the IRR and is the number of cash flows per year.
-
duration
public double duration(Leg leg, InterestRate y)
-
convexity
public double convexity(Leg cashFlows, InterestRate rate, Date settlementDate)
Cash-flow convexityThe convexity of a string of cash flows is defined as where is the present value of the cash flows according to the given IRR .
-
convexity
public double convexity(Leg leg, InterestRate y)
-
previousCashFlow
public final int previousCashFlow(Leg leg)
-
previousCouponRate
public final double previousCouponRate(Leg cashFlows)
-
nextCouponRate
public final double nextCouponRate(Leg leg)
-
nextCashFlow
public final CashFlow nextCashFlow(Leg cashFlows, Date settlement)
NOTE: should return null when no cashflow could be found!- Parameters:
cashFlows-settlement-- Returns:
-
nextCashFlowIndex
public final int nextCashFlowIndex(Leg cashFlows, Date settlement)
NOTE: returns the index! for cashflow.end() the returned index would throw a index out of bounds exception- Parameters:
cashFlows-settlement-- Returns:
-
yieldValueBasisPoint
public final double yieldValueBasisPoint(Leg leg, InterestRate y, Date settlementDate)
Yield value of a basis point The yield value of a one basis point change in price is the derivative of the yield with respect to the price multiplied by 0.01- Parameters:
leg-y-settlmentDate-- Returns:
-
yieldValueBasisPoint
public final double yieldValueBasisPoint(Leg leg, InterestRate y)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG