NonPeriodic
in package
Table of Contents
Constants
- DEFAULT_GUESS = 0.1
- FINANCIAL_MAX_ITERATIONS = 128
- FINANCIAL_PRECISION = 1.0E-8
Methods
- presentValue() : float|string
- XNPV.
- rate() : float|string
- XIRR.
- bothNegAndPos() : bool
- validateXnpv() : void
- xirrBisection() : string|float
- xirrPart1() : string
- xirrPart2() : string
- xirrPart3() : float|string
- xnpvOrdered() : float|string
Constants
DEFAULT_GUESS
public
mixed
DEFAULT_GUESS
= 0.1
FINANCIAL_MAX_ITERATIONS
public
mixed
FINANCIAL_MAX_ITERATIONS
= 128
FINANCIAL_PRECISION
public
mixed
FINANCIAL_PRECISION
= 1.0E-8
Methods
presentValue()
XNPV.
public
static presentValue(array<string|int, mixed>|float $rate, array<string|int, float> $values, array<string|int, mixed> $dates) : float|string
Returns the net present value for a schedule of cash flows that is not necessarily periodic. To calculate the net present value for a series of cash flows that is periodic, use the NPV function.
Excel Function: =XNPV(rate,values,dates)
Parameters
- $rate : array<string|int, mixed>|float
-
the discount rate to apply to the cash flows
- $values : array<string|int, float>
-
A series of cash flows that corresponds to a schedule of payments in dates. The first payment is optional and corresponds to a cost or payment that occurs at the beginning of the investment. If the first value is a cost or payment, it must be a negative value. All succeeding payments are discounted based on a 365-day year. The series of values must contain at least one positive value and one negative value.
- $dates : array<string|int, mixed>
-
A schedule of payment dates that corresponds to the cash flow payments. The first payment date indicates the beginning of the schedule of payments. All other dates must be later than this date, but they may occur in any order.
Return values
float|stringrate()
XIRR.
public
static rate(array<string|int, float> $values, array<string|int, mixed> $dates[, mixed $guess = self::DEFAULT_GUESS ]) : float|string
Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic.
Excel Function: =XIRR(values,dates,guess)
Parameters
- $values : array<string|int, float>
-
A series of cash flow payments The series of values must contain at least one positive value & one negative value
- $dates : array<string|int, mixed>
-
A series of payment dates The first payment date indicates the beginning of the schedule of payments All other dates must be later than this date, but they may occur in any order
- $guess : mixed = self::DEFAULT_GUESS
-
An optional guess at the expected answer
Return values
float|stringbothNegAndPos()
private
static bothNegAndPos(bool $neg, bool $pos) : bool
Parameters
- $neg : bool
- $pos : bool
Return values
boolvalidateXnpv()
private
static validateXnpv(mixed $rate, array<string|int, mixed> $values, array<string|int, mixed> $dates) : void
Parameters
- $rate : mixed
- $values : array<string|int, mixed>
- $dates : array<string|int, mixed>
xirrBisection()
private
static xirrBisection(array<string|int, mixed> $values, array<string|int, mixed> $dates, float $x1, float $x2) : string|float
Parameters
- $values : array<string|int, mixed>
- $dates : array<string|int, mixed>
- $x1 : float
- $x2 : float
Return values
string|floatxirrPart1()
private
static xirrPart1(mixed &$values, mixed &$dates) : string
Parameters
- $values : mixed
- $dates : mixed
Return values
stringxirrPart2()
private
static xirrPart2(array<string|int, mixed> &$values) : string
Parameters
- $values : array<string|int, mixed>
Return values
stringxirrPart3()
private
static xirrPart3(array<string|int, mixed> $values, array<string|int, mixed> $dates, float $x1, float $x2) : float|string
Parameters
- $values : array<string|int, mixed>
- $dates : array<string|int, mixed>
- $x1 : float
- $x2 : float
Return values
float|stringxnpvOrdered()
private
static xnpvOrdered(mixed $rate, array<int, float|int|numeric-string> $values, mixed $dates[, bool $ordered = true ][, bool $capAtNegative1 = false ]) : float|string
Parameters
- $rate : mixed
- $values : array<int, float|int|numeric-string>
-
- $dates : mixed
- $ordered : bool = true
- $capAtNegative1 : bool = false