org.jquantlib.termstructures
Class InterestRate
- java.lang.Object
-
- org.jquantlib.termstructures.InterestRate
-
public class InterestRate extends java.lang.ObjectThis class encapsulate the interest rate compounding algebra. It manages day-counting conventions, compounding conventions, conversion between different conventions, discount/compound factor calculations, and implied/equivalent rate calculations.
-
-
Constructor Summary
Constructors Constructor and Description InterestRate()Default constructor returning a null interest rate.InterestRate(double r, DayCounter dc)Standard constructor.InterestRate(double r, DayCounter dc, Compounding comp)Standard constructor.InterestRate(double r, DayCounter dc, Compounding comp, Frequency freq)Standard constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublecompoundFactor(Date d1, Date d2)doublecompoundFactor(Date d1, Date d2, Date refStart, Date refEnd)doublecompoundFactor(double time)Compoundingcompounding()DayCounterdayCounter()doublediscountFactor(Date d1, Date d2)doublediscountFactor(Date d1, Date d2, Date refStart)doublediscountFactor(Date d1, Date d2, Date refStart, Date refEnd)doublediscountFactor(double t)InterestRateequivalentRate(Date d1, Date d2, DayCounter resultDC, Compounding comp)InterestRateequivalentRate(Date d1, Date d2, DayCounter resultDC, Compounding comp, Frequency freq)Returns equivalent rate for a compounding period between two dates.InterestRateequivalentRate(double t, Compounding comp)InterestRateequivalentRate(double t, Compounding comp, Frequency freq)Returns equivalent interest rate for a compounding period t.Frequencyfrequency()static InterestRateimpliedRate(double compound, Date d1, Date d2, DayCounter resultDC, Compounding comp)static InterestRateimpliedRate(double compound, Date d1, Date d2, DayCounter resultDC, Compounding comp, Frequency freq)Implied rate for a given compound factor between two dates.static InterestRateimpliedRate(double compound, double t, DayCounter resultDC, Compounding comp)static InterestRateimpliedRate(double c, double time, DayCounter resultDC, Compounding comp, Frequency freq)Implied interest rate for a given compound factor at a given time.doublerate()java.lang.StringtoString()
-
-
-
Constructor Detail
-
InterestRate
public InterestRate()
Default constructor returning a null interest rate.
-
InterestRate
public InterestRate(double r, DayCounter dc)Standard constructor. Assumes aFrequency.Annual- Parameters:
r- represents the ratedc- is aDayCounter
-
InterestRate
public InterestRate(double r, DayCounter dc, Compounding comp)Standard constructor. Assumes aFrequency.Annual- Parameters:
r- represents the ratedc- is aDayCountercomp- is aCompounding
-
InterestRate
public InterestRate(double r, DayCounter dc, Compounding comp, Frequency freq)Standard constructor.- Parameters:
r- represents the ratedc- is aDayCountercomp- is aCompoundingfreq- represents aFrequency
-
-
Method Detail
-
compoundFactor
public final double compoundFactor(double time)
- Returns:
- the compound (a.k.a capitalization) factor implied by the rate compounded at time t.
-
dayCounter
public final DayCounter dayCounter()
- Returns:
- the
DayCounter
-
compounding
public final Compounding compounding()
- Returns:
- the
Compounding
-
discountFactor
public final double discountFactor(double t)
- Parameters:
t- time must be measured using InterestRate's own day counter.- Returns:
- discount factor implied by the rate compounded at time t.
-
discountFactor
public final double discountFactor(Date d1, Date d2)
- Parameters:
d1- is the start dated2- is the end date- Returns:
- discount factor implied by the rate compounded between two dates
-
discountFactor
public final double discountFactor(Date d1, Date d2, Date refStart)
- Parameters:
d1- is the start dated2- is the end daterefStart-- Returns:
- compound factor implied by the rate compounded between two dates
-
discountFactor
public final double discountFactor(Date d1, Date d2, Date refStart, Date refEnd)
- Returns:
- the compound (a.k.a capitalization) factor implied by the rate compounded between two dates.
-
equivalentRate
public final InterestRate equivalentRate(double t, Compounding comp)
-
equivalentRate
public final InterestRate equivalentRate(double t, Compounding comp, Frequency freq)
Returns equivalent interest rate for a compounding period t. The resulting InterestRate shares the same implicit day-counting rule of the original InterestRate instance.Time must be measured using the InterestRate's own day counter.
- Returns:
- equivalent interest rate for a compounding period t.
-
equivalentRate
public final InterestRate equivalentRate(Date d1, Date d2, DayCounter resultDC, Compounding comp)
-
equivalentRate
public final InterestRate equivalentRate(Date d1, Date d2, DayCounter resultDC, Compounding comp, Frequency freq)
Returns equivalent rate for a compounding period between two dates. The resulting rate is calculated taking the required day-counting rule into account.
-
impliedRate
public static InterestRate impliedRate(double c, double time, DayCounter resultDC, Compounding comp, Frequency freq)
Implied interest rate for a given compound factor at a given time. The resulting InterestRate has the day-counter provided as input.
-
impliedRate
public static InterestRate impliedRate(double compound, double t, DayCounter resultDC, Compounding comp)
-
impliedRate
public static InterestRate impliedRate(double compound, Date d1, Date d2, DayCounter resultDC, Compounding comp)
-
impliedRate
public static InterestRate impliedRate(double compound, Date d1, Date d2, DayCounter resultDC, Compounding comp, Frequency freq)
Implied rate for a given compound factor between two dates. The resulting rate is calculated taking the required day-counting rule into account.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
rate
public final double rate()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG