Class CashFlow

    • Method Detail

      • ofPresentValue

        public static CashFlow ofPresentValue​(LocalDate paymentDate,
                                              CurrencyAmount presentValue,
                                              double discountFactor)
        Creates a CashFlow representing a single cash flow from payment date, present value and discount factor.
        Parameters:
        paymentDate - the payment date
        presentValue - the present value as a currency amount
        discountFactor - the discount factor
        Returns:
        the cash flow instance
      • ofPresentValue

        public static CashFlow ofPresentValue​(LocalDate paymentDate,
                                              Currency currency,
                                              double presentValue,
                                              double discountFactor)
        Creates a CashFlow representing a single cash flow from payment date, present value amount, discount factor and currency.
        Parameters:
        paymentDate - the payment date
        currency - the currency
        presentValue - the amount of the present value
        discountFactor - the discount factor
        Returns:
        the cash flow instance
      • ofForecastValue

        public static CashFlow ofForecastValue​(LocalDate paymentDate,
                                               CurrencyAmount forecastValue,
                                               double discountFactor)
        Creates a CashFlow representing a single cash flow from payment date, forecast value and discount factor.
        Parameters:
        paymentDate - the payment date
        forecastValue - the forecast value as a currency amount
        discountFactor - the discount factor
        Returns:
        the cash flow instance
      • ofForecastValue

        public static CashFlow ofForecastValue​(LocalDate paymentDate,
                                               Currency currency,
                                               double forecastValue,
                                               double discountFactor)
        Creates a CashFlow representing a single cash flow from payment date, forecast value amount, discount factor and currency.
        Parameters:
        paymentDate - the payment date
        currency - the currency
        forecastValue - the amount of the forecast value
        discountFactor - 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:
        convertedTo in interface FxConvertible<CashFlow>
        Parameters:
        resultCurrency - the currency of the result
        rateProvider - 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:
        compareTo in interface Comparable<CashFlow>
        Parameters:
        other - the other instance
        Returns:
        the comparison
      • meta

        public static CashFlow.Meta meta()
        The meta-bean for CashFlow.
        Returns:
        the meta-bean, not null
      • metaBean

        public CashFlow.Meta metaBean()
        Specified by:
        metaBean in interface org.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
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object