Class CashFlow
- java.lang.Object
-
- com.opengamma.strata.market.amount.CashFlow
-
- All Implemented Interfaces:
FxConvertible<CashFlow>,Serializable,Comparable<CashFlow>,org.joda.beans.Bean,org.joda.beans.ImmutableBean
public final class CashFlow extends Object implements FxConvertible<CashFlow>, Comparable<CashFlow>, org.joda.beans.ImmutableBean, Serializable
A single cash flow of a currency amount on a specific date.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCashFlow.MetaThe meta-bean forCashFlow.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(CashFlow other)Compares this cash flow to another, first by date, then value.CashFlowconvertedTo(Currency resultCurrency, FxRateProvider rateProvider)Converts this cash flow to an equivalent amount in the specified currency.booleanequals(Object obj)doublegetDiscountFactor()Gets the discount factor.CurrencyAmountgetForecastValue()Gets the forecast value of the cash flow.LocalDategetPaymentDate()Gets the payment date.CurrencyAmountgetPresentValue()Gets the present value of the cash flow.inthashCode()static CashFlow.Metameta()The meta-bean forCashFlow.CashFlow.MetametaBean()static CashFlowofForecastValue(LocalDate paymentDate, CurrencyAmount forecastValue, double discountFactor)Creates aCashFlowrepresenting a single cash flow from payment date, forecast value and discount factor.static CashFlowofForecastValue(LocalDate paymentDate, Currency currency, double forecastValue, double discountFactor)Creates aCashFlowrepresenting a single cash flow from payment date, forecast value amount, discount factor and currency.static CashFlowofPresentValue(LocalDate paymentDate, CurrencyAmount presentValue, double discountFactor)Creates aCashFlowrepresenting a single cash flow from payment date, present value and discount factor.static CashFlowofPresentValue(LocalDate paymentDate, Currency currency, double presentValue, double discountFactor)Creates aCashFlowrepresenting a single cash flow from payment date, present value amount, discount factor and currency.StringtoString()
-
-
-
Method Detail
-
ofPresentValue
public static CashFlow ofPresentValue(LocalDate paymentDate, CurrencyAmount presentValue, double discountFactor)
Creates aCashFlowrepresenting a single cash flow from payment date, present value and discount factor.- Parameters:
paymentDate- the payment datepresentValue- the present value as a currency amountdiscountFactor- the discount factor- Returns:
- the cash flow instance
-
ofPresentValue
public static CashFlow ofPresentValue(LocalDate paymentDate, Currency currency, double presentValue, double discountFactor)
Creates aCashFlowrepresenting a single cash flow from payment date, present value amount, discount factor and currency.- Parameters:
paymentDate- the payment datecurrency- the currencypresentValue- the amount of the present valuediscountFactor- the discount factor- Returns:
- the cash flow instance
-
ofForecastValue
public static CashFlow ofForecastValue(LocalDate paymentDate, CurrencyAmount forecastValue, double discountFactor)
Creates aCashFlowrepresenting a single cash flow from payment date, forecast value and discount factor.- Parameters:
paymentDate- the payment dateforecastValue- the forecast value as a currency amountdiscountFactor- the discount factor- Returns:
- the cash flow instance
-
ofForecastValue
public static CashFlow ofForecastValue(LocalDate paymentDate, Currency currency, double forecastValue, double discountFactor)
Creates aCashFlowrepresenting a single cash flow from payment date, forecast value amount, discount factor and currency.- Parameters:
paymentDate- the payment datecurrency- the currencyforecastValue- the amount of the forecast valuediscountFactor- the discount factor- Returns:
- the cash flow instance
-
convertedTo
public CashFlow convertedTo(Currency resultCurrency, FxRateProvider rateProvider)
Converts this cash flow to an equivalent amount in the specified currency.The result will have both the present and forecast value expressed in terms of the given currency. If conversion is needed, the provider will be used to supply the FX rate.
- Specified by:
convertedToin interfaceFxConvertible<CashFlow>- Parameters:
resultCurrency- the currency of the resultrateProvider- the provider of FX rates- Returns:
- the converted instance, in the specified currency
- Throws:
RuntimeException- if no FX rate could be found
-
compareTo
public int compareTo(CashFlow other)
Compares this cash flow to another, first by date, then value.- Specified by:
compareToin interfaceComparable<CashFlow>- Parameters:
other- the other instance- Returns:
- the comparison
-
meta
public static CashFlow.Meta meta()
The meta-bean forCashFlow.- Returns:
- the meta-bean, not null
-
metaBean
public CashFlow.Meta metaBean()
- Specified by:
metaBeanin interfaceorg.joda.beans.Bean
-
getPaymentDate
public LocalDate getPaymentDate()
Gets the payment date.This is the date on which the cash flow occurs.
- Returns:
- the value of the property, not null
-
getPresentValue
public CurrencyAmount getPresentValue()
Gets the present value of the cash flow.The present value is signed. A negative value indicates a payment while a positive value indicates receipt.
- Returns:
- the value of the property, not null
-
getForecastValue
public CurrencyAmount getForecastValue()
Gets the forecast value of the cash flow.The forecast value is signed. A negative value indicates a payment while a positive value indicates receipt.
- Returns:
- the value of the property, not null
-
getDiscountFactor
public double getDiscountFactor()
Gets the discount factor.This is the discount factor between valuation date and the payment date. Thus present value is the forecast value multiplied by the discount factor.
- Returns:
- the value of the property
-
-