ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_Calculation_Financial Class Reference
+ Collaboration diagram for PHPExcel_Calculation_Financial:

Static Public Member Functions

static ACCRINT ($issue, $firstinter, $settlement, $rate, $par=1000, $frequency=1, $basis=0)
 ACCRINT.
static ACCRINTM ($issue, $settlement, $rate, $par=1000, $basis=0)
 ACCRINTM.
static AMORDEGRC ($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=0)
static AMORLINC ($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=0)
static COUPDAYBS ($settlement, $maturity, $frequency, $basis=0)
static COUPDAYS ($settlement, $maturity, $frequency, $basis=0)
static COUPDAYSNC ($settlement, $maturity, $frequency, $basis=0)
static COUPNCD ($settlement, $maturity, $frequency, $basis=0)
static COUPNUM ($settlement, $maturity, $frequency, $basis=0)
static COUPPCD ($settlement, $maturity, $frequency, $basis=0)
static CUMIPMT ($rate, $nper, $pv, $start, $end, $type=0)
 CUMIPMT.
static CUMPRINC ($rate, $nper, $pv, $start, $end, $type=0)
 CUMPRINC.
static DB ($cost, $salvage, $life, $period, $month=12)
 DB.
static DDB ($cost, $salvage, $life, $period, $factor=2.0)
 DDB.
static DISC ($settlement, $maturity, $price, $redemption, $basis=0)
 DISC.
static DOLLARDE ($fractional_dollar=Null, $fraction=0)
 DOLLARDE.
static DOLLARFR ($decimal_dollar=Null, $fraction=0)
 DOLLARFR.
static EFFECT ($nominal_rate=0, $npery=0)
 EFFECT.
static FV ($rate=0, $nper=0, $pmt=0, $pv=0, $type=0)
 FV.
static FVSCHEDULE ($principal, $schedule)
 FVSCHEDULE.
static INTRATE ($settlement, $maturity, $investment, $redemption, $basis=0)
 INTRATE.
static IPMT ($rate, $per, $nper, $pv, $fv=0, $type=0)
 IPMT.
static IRR ($values, $guess=0.1)
static ISPMT ()
 ISPMT.
static MIRR ($values, $finance_rate, $reinvestment_rate)
static NOMINAL ($effect_rate=0, $npery=0)
 NOMINAL.
static NPER ($rate=0, $pmt=0, $pv=0, $fv=0, $type=0)
 NPER.
static NPV ()
 NPV.
static PMT ($rate=0, $nper=0, $pv=0, $fv=0, $type=0)
 PMT.
static PPMT ($rate, $per, $nper, $pv, $fv=0, $type=0)
 PPMT.
static PRICE ($settlement, $maturity, $rate, $yield, $redemption, $frequency, $basis=0)
static PRICEDISC ($settlement, $maturity, $discount, $redemption, $basis=0)
 PRICEDISC.
static PRICEMAT ($settlement, $maturity, $issue, $rate, $yield, $basis=0)
 PRICEMAT.
static PV ($rate=0, $nper=0, $pmt=0, $fv=0, $type=0)
 PV.
static RATE ($nper, $pmt, $pv, $fv=0.0, $type=0, $guess=0.1)
 RATE.
static RECEIVED ($settlement, $maturity, $investment, $discount, $basis=0)
 RECEIVED.
static SLN ($cost, $salvage, $life)
 SLN.
static SYD ($cost, $salvage, $life, $period)
 SYD.
static TBILLEQ ($settlement, $maturity, $discount)
 TBILLEQ.
static TBILLPRICE ($settlement, $maturity, $discount)
 TBILLPRICE.
static TBILLYIELD ($settlement, $maturity, $price)
 TBILLYIELD.
static XIRR ($values, $dates, $guess=0.1)
static XNPV ($rate, $values, $dates)
 XNPV.
static YIELDDISC ($settlement, $maturity, $price, $redemption, $basis=0)
 YIELDDISC.
static YIELDMAT ($settlement, $maturity, $issue, $rate, $price, $basis=0)
 YIELDMAT.

Static Private Member Functions

static _lastDayOfMonth ($testDate)
static _firstDayOfMonth ($testDate)
static _coupFirstPeriodDate ($settlement, $maturity, $frequency, $next)
static _validFrequency ($frequency)
static _daysPerYear ($year, $basis)
static _interestAndPrincipal ($rate=0, $per=0, $nper=0, $pv=0, $fv=0, $type=0)

Detailed Description

Definition at line 53 of file Financial.php.

Member Function Documentation

static PHPExcel_Calculation_Financial::_coupFirstPeriodDate (   $settlement,
  $maturity,
  $frequency,
  $next 
)
staticprivate

Definition at line 68 of file Financial.php.

References _lastDayOfMonth(), PHPExcel_Shared_Date\ExcelToPHPObject(), and PHPExcel_Shared_Date\PHPToExcel().

Referenced by COUPDAYBS(), COUPDAYS(), COUPDAYSNC(), COUPNCD(), COUPNUM(), and COUPPCD().

{
$months = 12 / $frequency;
$eom = self::_lastDayOfMonth($result);
while ($settlement < PHPExcel_Shared_Date::PHPToExcel($result)) {
$result->modify('-'.$months.' months');
}
if ($next) {
$result->modify('+'.$months.' months');
}
if ($eom) {
$result->modify('-1 day');
}
} // function _coupFirstPeriodDate()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_Financial::_daysPerYear (   $year,
  $basis 
)
staticprivate

Definition at line 101 of file Financial.php.

References PHPExcel_Calculation_DateTime\_isLeapYear(), and PHPExcel_Calculation_Functions\NaN().

Referenced by COUPDAYBS(), COUPDAYS(), COUPDAYSNC(), PRICEMAT(), YIELDDISC(), and YIELDMAT().

{
switch ($basis) {
case 0 :
case 2 :
case 4 :
$daysPerYear = 360;
break;
case 3 :
$daysPerYear = 365;
break;
case 1 :
$daysPerYear = 366;
} else {
$daysPerYear = 365;
}
break;
default :
}
return $daysPerYear;
} // function _daysPerYear()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_Financial::_firstDayOfMonth (   $testDate)
staticprivate

Definition at line 62 of file Financial.php.

{
$date = clone $testDate;
return ($date->format('d') == 1);
} // function _lastDayOfMonth()
static PHPExcel_Calculation_Financial::_interestAndPrincipal (   $rate = 0,
  $per = 0,
  $nper = 0,
  $pv = 0,
  $fv = 0,
  $type = 0 
)
staticprivate

Definition at line 125 of file Financial.php.

References $type, and PMT().

Referenced by IPMT(), and PPMT().

{
$pmt = self::PMT($rate, $nper, $pv, $fv, $type);
$capital = $pv;
for ($i = 1; $i<= $per; ++$i) {
$interest = ($type && $i == 1) ? 0 : -$capital * $rate;
$principal = $pmt - $interest;
$capital += $principal;
}
return array($interest, $principal);
} // function _interestAndPrincipal()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_Financial::_lastDayOfMonth (   $testDate)
staticprivate

Definition at line 55 of file Financial.php.

Referenced by _coupFirstPeriodDate().

{
$date = clone $testDate;
$date->modify('+1 day');
return ($date->format('d') == 1);
} // function _lastDayOfMonth()

+ Here is the caller graph for this function:

static PHPExcel_Calculation_Financial::_validFrequency (   $frequency)
staticprivate

Definition at line 89 of file Financial.php.

References PHPExcel_Calculation_Functions\COMPATIBILITY_GNUMERIC, and PHPExcel_Calculation_Functions\getCompatibilityMode().

{
if (($frequency == 1) || ($frequency == 2) || ($frequency == 4)) {
return true;
}
(($frequency == 6) || ($frequency == 12))) {
return true;
}
return false;
} // function _validFrequency()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::ACCRINT (   $issue,
  $firstinter,
  $settlement,
  $rate,
  $par = 1000,
  $frequency = 1,
  $basis = 0 
)
static

ACCRINT.

Returns the discount rate for a security.

Parameters
mixedissue The security's issue date.
mixedfirstinter The security's first interest date.
mixedsettlement The security's settlement date.
floatrate The security's annual coupon rate.
floatpar The security's par value.
intbasis The type of day count to use. 0 or omitted US (NASD) 30/360 1 Actual/actual 2 Actual/360 3 Actual/365 4 European 30/360
Returns
float

Definition at line 155 of file Financial.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), PHPExcel_Calculation_Functions\VALUE(), and PHPExcel_Calculation_DateTime\YEARFRAC().

{
$par = (is_null($par)) ? 1000 : (float) PHPExcel_Calculation_Functions::flattenSingleValue($par);
$frequency = (is_null($frequency)) ? 1 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($frequency);
$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
// Validate
if ((is_numeric($rate)) && (is_numeric($par))) {
if (($rate <= 0) || ($par <= 0)) {
}
$daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis);
if (!is_numeric($daysBetweenIssueAndSettlement)) {
// return date error
return $daysBetweenIssueAndSettlement;
}
return $par * $rate * $daysBetweenIssueAndSettlement;
}
} // function ACCRINT()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::ACCRINTM (   $issue,
  $settlement,
  $rate,
  $par = 1000,
  $basis = 0 
)
static

ACCRINTM.

Returns the discount rate for a security.

Parameters
mixedissue The security's issue date.
mixedsettlement The security's settlement date.
floatrate The security's annual coupon rate.
floatpar The security's par value.
intbasis The type of day count to use. 0 or omitted US (NASD) 30/360 1 Actual/actual 2 Actual/360 3 Actual/365 4 European 30/360
Returns
float

Definition at line 198 of file Financial.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), PHPExcel_Calculation_Functions\VALUE(), and PHPExcel_Calculation_DateTime\YEARFRAC().

{
$par = (is_null($par)) ? 1000 : (float) PHPExcel_Calculation_Functions::flattenSingleValue($par);
$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
// Validate
if ((is_numeric($rate)) && (is_numeric($par))) {
if (($rate <= 0) || ($par <= 0)) {
}
$daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis);
if (!is_numeric($daysBetweenIssueAndSettlement)) {
// return date error
return $daysBetweenIssueAndSettlement;
}
return $par * $rate * $daysBetweenIssueAndSettlement;
}
} // function ACCRINTM()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::AMORDEGRC (   $cost,
  $purchased,
  $firstPeriod,
  $salvage,
  $period,
  $rate,
  $basis = 0 
)
static

Definition at line 221 of file Financial.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_DateTime\YEARFRAC().

{
$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
$fUsePer = 1.0 / $rate;
if ($fUsePer < 3.0) {
$amortiseCoeff = 1.0;
} elseif ($fUsePer < 5.0) {
$amortiseCoeff = 1.5;
} elseif ($fUsePer <= 6.0) {
$amortiseCoeff = 2.0;
} else {
$amortiseCoeff = 2.5;
}
$rate *= $amortiseCoeff;
$fNRate = round(PHPExcel_Calculation_DateTime::YEARFRAC($purchased, $firstPeriod, $basis) * $rate * $cost,0);
$cost -= $fNRate;
$fRest = $cost - $salvage;
for ($n = 0; $n < $period; ++$n) {
$fNRate = round($rate * $cost,0);
$fRest -= $fNRate;
if ($fRest < 0.0) {
switch ($period - $n) {
case 0 :
case 1 : return round($cost * 0.5,0);
break;
default : return 0.0;
break;
}
}
$cost -= $fNRate;
}
return $fNRate;
} // function AMORDEGRC()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::AMORLINC (   $cost,
  $purchased,
  $firstPeriod,
  $salvage,
  $period,
  $rate,
  $basis = 0 
)
static

Definition at line 266 of file Financial.php.

References PHPExcel_Calculation_DateTime\_isLeapYear(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_DateTime\YEAR(), and PHPExcel_Calculation_DateTime\YEARFRAC().

{
$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
$fOneRate = $cost * $rate;
$fCostDelta = $cost - $salvage;
// Note, quirky variation for leap years on the YEARFRAC for this function
$purchasedYear = PHPExcel_Calculation_DateTime::YEAR($purchased);
$yearFrac = PHPExcel_Calculation_DateTime::YEARFRAC($purchased, $firstPeriod, $basis);
if (($basis == 1) && ($yearFrac < 1) && (PHPExcel_Calculation_DateTime::_isLeapYear($purchasedYear))) {
$yearFrac *= 365 / 366;
}
$f0Rate = $yearFrac * $rate * $cost;
$nNumOfFullPeriods = intval(($cost - $salvage - $f0Rate) / $fOneRate);
if ($period == 0) {
return $f0Rate;
} elseif ($period <= $nNumOfFullPeriods) {
return $fOneRate;
} elseif ($period == ($nNumOfFullPeriods + 1)) {
return ($fCostDelta - $fOneRate * $nNumOfFullPeriods - $f0Rate);
} else {
return 0.0;
}
} // function AMORLINC()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::COUPDAYBS (   $settlement,
  $maturity,
  $frequency,
  $basis = 0 
)
static

Definition at line 300 of file Financial.php.

References _coupFirstPeriodDate(), _daysPerYear(), PHPExcel_Calculation_DateTime\_getDateValue(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), PHPExcel_Calculation_Functions\VALUE(), PHPExcel_Calculation_DateTime\YEAR(), and PHPExcel_Calculation_DateTime\YEARFRAC().

Referenced by PRICE().

{
$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) {
}
if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) {
}
if (($settlement > $maturity) ||
(!self::_validFrequency($frequency)) ||
(($basis < 0) || ($basis > 4))) {
}
$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement),$basis);
$prev = self::_coupFirstPeriodDate($settlement, $maturity, $frequency, False);
return PHPExcel_Calculation_DateTime::YEARFRAC($prev, $settlement, $basis) * $daysPerYear;
} // function COUPDAYBS()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_Financial::COUPDAYS (   $settlement,
  $maturity,
  $frequency,
  $basis = 0 
)
static

Definition at line 326 of file Financial.php.

References _coupFirstPeriodDate(), _daysPerYear(), PHPExcel_Calculation_DateTime\_getDateValue(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), PHPExcel_Calculation_Functions\VALUE(), and PHPExcel_Calculation_DateTime\YEAR().

Referenced by PRICE().

{
$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) {
}
if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) {
}
if (($settlement > $maturity) ||
(!self::_validFrequency($frequency)) ||
(($basis < 0) || ($basis > 4))) {
}
switch ($basis) {
case 3: // Actual/365
return 365 / $frequency;
case 1: // Actual/actual
if ($frequency == 1) {
$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($maturity),$basis);
return ($daysPerYear / $frequency);
} else {
$prev = self::_coupFirstPeriodDate($settlement, $maturity, $frequency, False);
$next = self::_coupFirstPeriodDate($settlement, $maturity, $frequency, True);
return ($next - $prev);
}
default: // US (NASD) 30/360, Actual/360 or European 30/360
return 360 / $frequency;
}
} // function COUPDAYS()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_Financial::COUPDAYSNC (   $settlement,
  $maturity,
  $frequency,
  $basis = 0 
)
static

Definition at line 364 of file Financial.php.

References _coupFirstPeriodDate(), _daysPerYear(), PHPExcel_Calculation_DateTime\_getDateValue(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), PHPExcel_Calculation_Functions\VALUE(), PHPExcel_Calculation_DateTime\YEAR(), and PHPExcel_Calculation_DateTime\YEARFRAC().

Referenced by PRICE().

{
$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) {
}
if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) {
}
if (($settlement > $maturity) ||
(!self::_validFrequency($frequency)) ||
(($basis < 0) || ($basis > 4))) {
}
$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement),$basis);
$next = self::_coupFirstPeriodDate($settlement, $maturity, $frequency, True);
return PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $next, $basis) * $daysPerYear;
} // function COUPDAYSNC()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_Financial::COUPNCD (   $settlement,
  $maturity,
  $frequency,
  $basis = 0 
)
static

Definition at line 390 of file Financial.php.

References _coupFirstPeriodDate(), PHPExcel_Calculation_DateTime\_getDateValue(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

{
$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) {
}
if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) {
}
if (($settlement > $maturity) ||
(!self::_validFrequency($frequency)) ||
(($basis < 0) || ($basis > 4))) {
}
return self::_coupFirstPeriodDate($settlement, $maturity, $frequency, True);
} // function COUPNCD()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::COUPNUM (   $settlement,
  $maturity,
  $frequency,
  $basis = 0 
)
static

Definition at line 413 of file Financial.php.

References _coupFirstPeriodDate(), PHPExcel_Calculation_DateTime\_getDateValue(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), PHPExcel_Calculation_Functions\VALUE(), and PHPExcel_Calculation_DateTime\YEARFRAC().

Referenced by PRICE().

{
$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) {
}
if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) {
}
if (($settlement > $maturity) ||
(!self::_validFrequency($frequency)) ||
(($basis < 0) || ($basis > 4))) {
}
$settlement = self::_coupFirstPeriodDate($settlement, $maturity, $frequency, True);
$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis) * 365;
switch ($frequency) {
case 1: // annual payments
return ceil($daysBetweenSettlementAndMaturity / 360);
case 2: // half-yearly
return ceil($daysBetweenSettlementAndMaturity / 180);
case 4: // quarterly
return ceil($daysBetweenSettlementAndMaturity / 90);
case 6: // bimonthly
return ceil($daysBetweenSettlementAndMaturity / 60);
case 12: // monthly
return ceil($daysBetweenSettlementAndMaturity / 30);
}
} // function COUPNUM()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_Financial::COUPPCD (   $settlement,
  $maturity,
  $frequency,
  $basis = 0 
)
static

Definition at line 451 of file Financial.php.

References _coupFirstPeriodDate(), PHPExcel_Calculation_DateTime\_getDateValue(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

{
$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) {
}
if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) {
}
if (($settlement > $maturity) ||
(!self::_validFrequency($frequency)) ||
(($basis < 0) || ($basis > 4))) {
}
return self::_coupFirstPeriodDate($settlement, $maturity, $frequency, False);
} // function COUPPCD()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::CUMIPMT (   $rate,
  $nper,
  $pv,
  $start,
  $end,
  $type = 0 
)
static

CUMIPMT.

Returns the cumulative interest paid on a loan between start_period and end_period.

Parameters
float$rateInterest rate per period
int$nperNumber of periods
float$pvPresent Value
intstart The first period in the calculation. Payment periods are numbered beginning with 1.
intend The last period in the calculation.
int$typePayment type: 0 = at the end of each period, 1 = at the beginning of each period
Returns
float

Definition at line 488 of file Financial.php.

References $type, PHPExcel_Calculation_Functions\flattenSingleValue(), IPMT(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

{
// Validate parameters
if ($type != 0 && $type != 1) {
}
if ($start < 1 || $start > $end) {
}
// Calculate
$interest = 0;
for ($per = $start; $per <= $end; ++$per) {
$interest += self::IPMT($rate, $per, $nper, $pv, 0, $type);
}
return $interest;
} // function CUMIPMT()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::CUMPRINC (   $rate,
  $nper,
  $pv,
  $start,
  $end,
  $type = 0 
)
static

CUMPRINC.

Returns the cumulative principal paid on a loan between start_period and end_period.

Parameters
float$rateInterest rate per period
int$nperNumber of periods
float$pvPresent Value
intstart The first period in the calculation. Payment periods are numbered beginning with 1.
intend The last period in the calculation.
int$typePayment type: 0 = at the end of each period, 1 = at the beginning of each period
Returns
float

Definition at line 528 of file Financial.php.

References $type, PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), PPMT(), and PHPExcel_Calculation_Functions\VALUE().

{
// Validate parameters
if ($type != 0 && $type != 1) {
}
if ($start < 1 || $start > $end) {
}
// Calculate
$principal = 0;
for ($per = $start; $per <= $end; ++$per) {
$principal += self::PPMT($rate, $per, $nper, $pv, 0, $type);
}
return $principal;
} // function CUMPRINC()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::DB (   $cost,
  $salvage,
  $life,
  $period,
  $month = 12 
)
static

DB.

Returns the depreciation of an asset for a specified period using the fixed-declining balance method. This form of depreciation is used if you want to get a higher depreciation value at the beginning of the depreciation (as opposed to linear depreciation). The depreciation value is reduced with every depreciation period by the depreciation already deducted from the initial cost.

Parameters
floatcost Initial cost of the asset.
floatsalvage Value at the end of the depreciation. (Sometimes called the salvage value of the asset)
intlife Number of periods over which the asset is depreciated. (Sometimes called the useful life of the asset)
intperiod The period for which you want to calculate the depreciation. Period must use the same units as life.
floatmonth Number of months in the first year. If month is omitted, it defaults to 12.
Returns
float

Definition at line 569 of file Financial.php.

References PHPExcel_Calculation_Functions\COMPATIBILITY_GNUMERIC, PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\getCompatibilityMode(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

{
// Validate
if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($month))) {
if ($cost == 0) {
return 0.0;
} elseif (($cost < 0) || (($salvage / $cost) < 0) || ($life <= 0) || ($period < 1) || ($month < 1)) {
}
// Set Fixed Depreciation Rate
$fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life));
$fixedDepreciationRate = round($fixedDepreciationRate, 3);
// Loop through each period calculating the depreciation
$previousDepreciation = 0;
for ($per = 1; $per <= $period; ++$per) {
if ($per == 1) {
$depreciation = $cost * $fixedDepreciationRate * $month / 12;
} elseif ($per == ($life + 1)) {
$depreciation = ($cost - $previousDepreciation) * $fixedDepreciationRate * (12 - $month) / 12;
} else {
$depreciation = ($cost - $previousDepreciation) * $fixedDepreciationRate;
}
$previousDepreciation += $depreciation;
}
$depreciation = round($depreciation,2);
}
return $depreciation;
}
} // function DB()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::DDB (   $cost,
  $salvage,
  $life,
  $period,
  $factor = 2.0 
)
static

DDB.

Returns the depreciation of an asset for a specified period using the double-declining balance method or some other method you specify.

Parameters
floatcost Initial cost of the asset.
floatsalvage Value at the end of the depreciation. (Sometimes called the salvage value of the asset)
intlife Number of periods over which the asset is depreciated. (Sometimes called the useful life of the asset)
intperiod The period for which you want to calculate the depreciation. Period must use the same units as life.
floatfactor The rate at which the balance declines. If factor is omitted, it is assumed to be 2 (the double-declining balance method).
Returns
float

Definition at line 621 of file Financial.php.

References PHPExcel_Calculation_Functions\COMPATIBILITY_GNUMERIC, PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\getCompatibilityMode(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

{
// Validate
if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period)) && (is_numeric($factor))) {
if (($cost <= 0) || (($salvage / $cost) < 0) || ($life <= 0) || ($period < 1) || ($factor <= 0.0) || ($period > $life)) {
}
// Set Fixed Depreciation Rate
$fixedDepreciationRate = 1 - pow(($salvage / $cost), (1 / $life));
$fixedDepreciationRate = round($fixedDepreciationRate, 3);
// Loop through each period calculating the depreciation
$previousDepreciation = 0;
for ($per = 1; $per <= $period; ++$per) {
$depreciation = min( ($cost - $previousDepreciation) * ($factor / $life), ($cost - $salvage - $previousDepreciation) );
$previousDepreciation += $depreciation;
}
$depreciation = round($depreciation,2);
}
return $depreciation;
}
} // function DDB()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::DISC (   $settlement,
  $maturity,
  $price,
  $redemption,
  $basis = 0 
)
static

DISC.

Returns the discount rate for a security.

Parameters
mixedsettlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
mixedmaturity The security's maturity date. The maturity date is the date when the security expires.
intprice The security's price per $100 face value.
intredemption the security's redemption value per $100 face value.
intbasis The type of day count to use. 0 or omitted US (NASD) 30/360 1 Actual/actual 2 Actual/360 3 Actual/365 4 European 30/360
Returns
float

Definition at line 671 of file Financial.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), PHPExcel_Calculation_Functions\VALUE(), and PHPExcel_Calculation_DateTime\YEARFRAC().

{
$redemption = (float) PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
// Validate
if ((is_numeric($price)) && (is_numeric($redemption)) && (is_numeric($basis))) {
if (($price <= 0) || ($redemption <= 0)) {
}
$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
}
return ((1 - $price / $redemption) / $daysBetweenSettlementAndMaturity);
}
} // function DISC()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::DOLLARDE (   $fractional_dollar = Null,
  $fraction = 0 
)
static

DOLLARDE.

Converts a dollar price expressed as an integer part and a fraction part into a dollar price expressed as a decimal number. Fractional dollar numbers are sometimes used for security prices.

Parameters
float$fractional_dollarFractional Dollar
int$fractionFraction
Returns
float

Definition at line 705 of file Financial.php.

References PHPExcel_Calculation_Functions\DIV0(), PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\NaN().

{
$fractional_dollar = PHPExcel_Calculation_Functions::flattenSingleValue($fractional_dollar);
// Validate parameters
if (is_null($fractional_dollar) || $fraction < 0) {
}
if ($fraction == 0) {
}
$dollars = floor($fractional_dollar);
$cents = fmod($fractional_dollar,1);
$cents /= $fraction;
$cents *= pow(10,ceil(log10($fraction)));
return $dollars + $cents;
} // function DOLLARDE()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::DOLLARFR (   $decimal_dollar = Null,
  $fraction = 0 
)
static

DOLLARFR.

Converts a dollar price expressed as a decimal number into a dollar price expressed as a fraction. Fractional dollar numbers are sometimes used for security prices.

Parameters
float$decimal_dollarDecimal Dollar
int$fractionFraction
Returns
float

Definition at line 735 of file Financial.php.

References PHPExcel_Calculation_Functions\DIV0(), PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\NaN().

{
$decimal_dollar = PHPExcel_Calculation_Functions::flattenSingleValue($decimal_dollar);
// Validate parameters
if (is_null($decimal_dollar) || $fraction < 0) {
}
if ($fraction == 0) {
}
$dollars = floor($decimal_dollar);
$cents = fmod($decimal_dollar,1);
$cents *= $fraction;
$cents *= pow(10,-ceil(log10($fraction)));
return $dollars + $cents;
} // function DOLLARFR()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::EFFECT (   $nominal_rate = 0,
  $npery = 0 
)
static

EFFECT.

Returns the effective interest rate given the nominal rate and the number of compounding payments per year.

Parameters
float$nominal_rateNominal interest rate
int$nperyNumber of compounding payments per year
Returns
float

Definition at line 764 of file Financial.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\NaN().

{
// Validate parameters
if ($nominal_rate <= 0 || $npery < 1) {
}
return pow((1 + $nominal_rate / $npery), $npery) - 1;
} // function EFFECT()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::FV (   $rate = 0,
  $nper = 0,
  $pmt = 0,
  $pv = 0,
  $type = 0 
)
static

FV.

Returns the Future Value of a cash flow with constant payments and interest rate (annuities).

Parameters
float$rateInterest rate per period
int$nperNumber of periods
float$pmtPeriodic payment (annuity)
float$pvPresent Value
int$typePayment type: 0 = at the end of each period, 1 = at the beginning of each period
Returns
float

Definition at line 789 of file Financial.php.

References $type, PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\NaN().

{
// Validate parameters
if ($type != 0 && $type != 1) {
}
// Calculate
if (!is_null($rate) && $rate != 0) {
return -$pv * pow(1 + $rate, $nper) - $pmt * (1 + $rate * $type) * (pow(1 + $rate, $nper) - 1) / $rate;
} else {
return -$pv - $pmt * $nper;
}
} // function FV()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::FVSCHEDULE (   $principal,
  $schedule 
)
static

FVSCHEDULE.

Definition at line 814 of file Financial.php.

References PHPExcel_Calculation_Functions\flattenArray(), and PHPExcel_Calculation_Functions\flattenSingleValue().

{
foreach($schedule as $n) {
$principal *= 1 + $n;
}
return $principal;
} // function FVSCHEDULE()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::INTRATE (   $settlement,
  $maturity,
  $investment,
  $redemption,
  $basis = 0 
)
static

INTRATE.

Returns the interest rate for a fully invested security.

Parameters
mixedsettlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
mixedmaturity The security's maturity date. The maturity date is the date when the security expires.
intinvestment The amount invested in the security.
intredemption The amount to be received at maturity.
intbasis The type of day count to use. 0 or omitted US (NASD) 30/360 1 Actual/actual 2 Actual/360 3 Actual/365 4 European 30/360
Returns
float

Definition at line 845 of file Financial.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), PHPExcel_Calculation_Functions\VALUE(), and PHPExcel_Calculation_DateTime\YEARFRAC().

{
$investment = (float) PHPExcel_Calculation_Functions::flattenSingleValue($investment);
$redemption = (float) PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
// Validate
if ((is_numeric($investment)) && (is_numeric($redemption)) && (is_numeric($basis))) {
if (($investment <= 0) || ($redemption <= 0)) {
}
$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
}
return (($redemption / $investment) - 1) / ($daysBetweenSettlementAndMaturity);
}
} // function INTRATE()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::IPMT (   $rate,
  $per,
  $nper,
  $pv,
  $fv = 0,
  $type = 0 
)
static

IPMT.

Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate.

Parameters
float$rateInterest rate per period
int$perPeriod for which we want to find the interest
int$nperNumber of periods
float$pvPresent Value
float$fvFuture Value
int$typePayment type: 0 = at the end of each period, 1 = at the beginning of each period
Returns
float

Definition at line 882 of file Financial.php.

References $type, _interestAndPrincipal(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

Referenced by CUMIPMT().

{
// Validate parameters
if ($type != 0 && $type != 1) {
}
if ($per <= 0 || $per > $nper) {
}
// Calculate
$interestAndPrincipal = self::_interestAndPrincipal($rate, $per, $nper, $pv, $fv, $type);
return $interestAndPrincipal[0];
} // function IPMT()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_Financial::IRR (   $values,
  $guess = 0.1 
)
static

Definition at line 904 of file Financial.php.

References $f, FINANCIAL_MAX_ITERATIONS, FINANCIAL_PRECISION, PHPExcel_Calculation_Functions\flattenArray(), PHPExcel_Calculation_Functions\flattenSingleValue(), NPV(), and PHPExcel_Calculation_Functions\VALUE().

{
if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE();
// create an initial range, with a root somewhere between 0 and guess
$x1 = 0.0;
$x2 = $guess;
$f1 = self::NPV($x1, $values);
$f2 = self::NPV($x2, $values);
for ($i = 0; $i < FINANCIAL_MAX_ITERATIONS; ++$i) {
if (($f1 * $f2) < 0.0) break;
if (abs($f1) < abs($f2)) {
$f1 = self::NPV($x1 += 1.6 * ($x1 - $x2), $values);
} else {
$f2 = self::NPV($x2 += 1.6 * ($x2 - $x1), $values);
}
}
if (($f1 * $f2) > 0.0) return PHPExcel_Calculation_Functions::VALUE();
$f = self::NPV($x1, $values);
if ($f < 0.0) {
$rtb = $x1;
$dx = $x2 - $x1;
} else {
$rtb = $x2;
$dx = $x1 - $x2;
}
for ($i = 0; $i < FINANCIAL_MAX_ITERATIONS; ++$i) {
$dx *= 0.5;
$x_mid = $rtb + $dx;
$f_mid = self::NPV($x_mid, $values);
if ($f_mid <= 0.0) $rtb = $x_mid;
if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) return $x_mid;
}
} // function IRR()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::ISPMT ( )
static

ISPMT.

Returns the interest payment for an investment based on an interest rate and a constant payment schedule.

Excel Function: =ISPMT(interest_rate, period, number_payments, PV)

interest_rate is the interest rate for the investment

period is the period to calculate the interest rate. It must be betweeen 1 and number_payments.

number_payments is the number of payments for the annuity

PV is the loan amount or present value of the payments

Definition at line 960 of file Financial.php.

References PHPExcel_Calculation_Functions\flattenArray().

{
// Return value
$returnValue = 0;
// Get the parameters
$interestRate = array_shift($aArgs);
$period = array_shift($aArgs);
$numberPeriods = array_shift($aArgs);
$principleRemaining = array_shift($aArgs);
// Calculate
$principlePayment = ($principleRemaining * 1.0) / ($numberPeriods * 1.0);
for($i=0; $i <= $period; ++$i) {
$returnValue = $interestRate * $principleRemaining * -1;
$principleRemaining -= $principlePayment;
// principle needs to be 0 after the last payment, don't let floating point screw it up
if($i == $numberPeriods) {
$returnValue = 0;
}
}
return($returnValue);
} // function ISPMT()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::MIRR (   $values,
  $finance_rate,
  $reinvestment_rate 
)
static

Definition at line 985 of file Financial.php.

References PHPExcel_Calculation_Functions\flattenArray(), PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\VALUE().

{
if (!is_array($values)) return PHPExcel_Calculation_Functions::VALUE();
$reinvestment_rate = PHPExcel_Calculation_Functions::flattenSingleValue($reinvestment_rate);
$n = count($values);
$rr = 1.0 + $reinvestment_rate;
$fr = 1.0 + $finance_rate;
$npv_pos = $npv_neg = 0.0;
foreach($values as $i => $v) {
if ($v >= 0) {
$npv_pos += $v / pow($rr, $i);
} else {
$npv_neg += $v / pow($fr, $i);
}
}
if (($npv_neg == 0) || ($npv_pos == 0) || ($reinvestment_rate <= -1)) {
}
$mirr = pow((-$npv_pos * pow($rr, $n))
/ ($npv_neg * ($rr)), (1.0 / ($n - 1))) - 1.0;
return (is_finite($mirr) ? $mirr : PHPExcel_Calculation_Functions::VALUE());
} // function MIRR()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::NOMINAL (   $effect_rate = 0,
  $npery = 0 
)
static

NOMINAL.

Returns the nominal interest rate given the effective rate and the number of compounding payments per year.

Parameters
float$effect_rateEffective interest rate
int$nperyNumber of compounding payments per year
Returns
float

Definition at line 1024 of file Financial.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\NaN().

{
// Validate parameters
if ($effect_rate <= 0 || $npery < 1) {
}
// Calculate
return $npery * (pow($effect_rate + 1, 1 / $npery) - 1);
} // function NOMINAL()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::NPER (   $rate = 0,
  $pmt = 0,
  $pv = 0,
  $fv = 0,
  $type = 0 
)
static

NPER.

Returns the number of periods for a cash flow with constant periodic payments (annuities), and interest rate.

 @param     float   $rate   Interest rate per period
 @param     int             $pmt    Periodic payment (annuity)
 @param     float   $pv             Present Value
 @param     float   $fv             Future Value
 @param     int             $type   Payment type: 0 = at the end of each period, 1 = at the beginning of each period
 @return    float

Definition at line 1050 of file Financial.php.

References $type, PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\NaN().

{
// Validate parameters
if ($type != 0 && $type != 1) {
}
// Calculate
if (!is_null($rate) && $rate != 0) {
if ($pmt == 0 && $pv == 0) {
}
return log(($pmt * (1 + $rate * $type) / $rate - $fv) / ($pv + $pmt * (1 + $rate * $type) / $rate)) / log(1 + $rate);
} else {
if ($pmt == 0) {
}
return (-$pv -$fv) / $pmt;
}
} // function NPER()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::NPV ( )
static

NPV.

Returns the Net Present Value of a cash flow series given a discount rate.

Parameters
floatDiscount interest rate
arrayCash flow series
Returns
float

Definition at line 1086 of file Financial.php.

References PHPExcel_Calculation_Functions\flattenArray().

Referenced by IRR().

{
// Return value
$returnValue = 0;
// Loop through arguments
// Calculate
$rate = array_shift($aArgs);
for ($i = 1; $i <= count($aArgs); ++$i) {
// Is it a numeric value?
if (is_numeric($aArgs[$i - 1])) {
$returnValue += $aArgs[$i - 1] / pow(1 + $rate, $i);
}
}
// Return
return $returnValue;
} // function NPV()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_Financial::PMT (   $rate = 0,
  $nper = 0,
  $pv = 0,
  $fv = 0,
  $type = 0 
)
static

PMT.

Returns the constant payment (annuity) for a cash flow with a constant interest rate.

Parameters
float$rateInterest rate per period
int$nperNumber of periods
float$pvPresent Value
float$fvFuture Value
int$typePayment type: 0 = at the end of each period, 1 = at the beginning of each period
Returns
float

Definition at line 1119 of file Financial.php.

References $type, PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\NaN().

Referenced by _interestAndPrincipal().

{
// Validate parameters
if ($type != 0 && $type != 1) {
}
// Calculate
if (!is_null($rate) && $rate != 0) {
return (-$fv - $pv * pow(1 + $rate, $nper)) / (1 + $rate * $type) / ((pow(1 + $rate, $nper) - 1) / $rate);
} else {
return (-$pv - $fv) / $nper;
}
} // function PMT()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_Financial::PPMT (   $rate,
  $per,
  $nper,
  $pv,
  $fv = 0,
  $type = 0 
)
static

PPMT.

Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate.

Parameters
float$rateInterest rate per period
int$perPeriod for which we want to find the interest
int$nperNumber of periods
float$pvPresent Value
float$fvFuture Value
int$typePayment type: 0 = at the end of each period, 1 = at the beginning of each period
Returns
float

Definition at line 1153 of file Financial.php.

References $type, _interestAndPrincipal(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

Referenced by CUMPRINC().

{
// Validate parameters
if ($type != 0 && $type != 1) {
}
if ($per <= 0 || $per > $nper) {
}
// Calculate
$interestAndPrincipal = self::_interestAndPrincipal($rate, $per, $nper, $pv, $fv, $type);
return $interestAndPrincipal[1];
} // function PPMT()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_Financial::PRICE (   $settlement,
  $maturity,
  $rate,
  $yield,
  $redemption,
  $frequency,
  $basis = 0 
)
static

Definition at line 1175 of file Financial.php.

References PHPExcel_Calculation_DateTime\_getDateValue(), COUPDAYBS(), COUPDAYS(), COUPDAYSNC(), COUPNUM(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

{
$redemption = (float) PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
$basis = (is_null($basis)) ? 0 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($basis);
if (is_string($settlement = PHPExcel_Calculation_DateTime::_getDateValue($settlement))) {
}
if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) {
}
if (($settlement > $maturity) ||
(!self::_validFrequency($frequency)) ||
(($basis < 0) || ($basis > 4))) {
}
$dsc = self::COUPDAYSNC($settlement, $maturity, $frequency, $basis);
$e = self::COUPDAYS($settlement, $maturity, $frequency, $basis);
$n = self::COUPNUM($settlement, $maturity, $frequency, $basis);
$a = self::COUPDAYBS($settlement, $maturity, $frequency, $basis);
$baseYF = 1.0 + ($yield / $frequency);
$rfp = 100 * ($rate / $frequency);
$de = $dsc / $e;
$result = $redemption / pow($baseYF, (--$n + $de));
for($k = 0; $k <= $n; ++$k) {
$result += $rfp / (pow($baseYF, ($k + $de)));
}
$result -= $rfp * ($a / $e);
return $result;
} // function PRICE()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::PRICEDISC (   $settlement,
  $maturity,
  $discount,
  $redemption,
  $basis = 0 
)
static

PRICEDISC.

Returns the price per $100 face value of a discounted security.

Parameters
mixedsettlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
mixedmaturity The security's maturity date. The maturity date is the date when the security expires.
intdiscount The security's discount rate.
intredemption The security's redemption value per $100 face value.
intbasis The type of day count to use. 0 or omitted US (NASD) 30/360 1 Actual/actual 2 Actual/360 3 Actual/365 4 European 30/360
Returns
float

Definition at line 1235 of file Financial.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), PHPExcel_Calculation_Functions\VALUE(), and PHPExcel_Calculation_DateTime\YEARFRAC().

{
$redemption = (float) PHPExcel_Calculation_Functions::flattenSingleValue($redemption);
// Validate
if ((is_numeric($discount)) && (is_numeric($redemption)) && (is_numeric($basis))) {
if (($discount <= 0) || ($redemption <= 0)) {
}
$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
}
return $redemption * (1 - $discount * $daysBetweenSettlementAndMaturity);
}
} // function PRICEDISC()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::PRICEMAT (   $settlement,
  $maturity,
  $issue,
  $rate,
  $yield,
  $basis = 0 
)
static

PRICEMAT.

Returns the price per $100 face value of a security that pays interest at maturity.

Parameters
mixedsettlement The security's settlement date. The security's settlement date is the date after the issue date when the security is traded to the buyer.
mixedmaturity The security's maturity date. The maturity date is the date when the security expires.
mixedissue The security's issue date.
intrate The security's interest rate at date of issue.
intyield The security's annual yield.
intbasis The type of day count to use. 0 or omitted US (NASD) 30/360 1 Actual/actual 2 Actual/360 3 Actual/365 4 European 30/360
Returns
float

Definition at line 1279 of file Financial.php.

References _daysPerYear(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), PHPExcel_Calculation_Functions\VALUE(), PHPExcel_Calculation_DateTime\YEAR(), and PHPExcel_Calculation_DateTime\YEARFRAC().

{
// Validate
if (is_numeric($rate) && is_numeric($yield)) {
if (($rate <= 0) || ($yield <= 0)) {
}
$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement),$basis);
if (!is_numeric($daysPerYear)) {
return $daysPerYear;
}
$daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis);
if (!is_numeric($daysBetweenIssueAndSettlement)) {
// return date error
return $daysBetweenIssueAndSettlement;
}
$daysBetweenIssueAndSettlement *= $daysPerYear;
$daysBetweenIssueAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $maturity, $basis);
if (!is_numeric($daysBetweenIssueAndMaturity)) {
// return date error
return $daysBetweenIssueAndMaturity;
}
$daysBetweenIssueAndMaturity *= $daysPerYear;
$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
}
$daysBetweenSettlementAndMaturity *= $daysPerYear;
return ((100 + (($daysBetweenIssueAndMaturity / $daysPerYear) * $rate * 100)) /
(1 + (($daysBetweenSettlementAndMaturity / $daysPerYear) * $yield)) -
(($daysBetweenIssueAndSettlement / $daysPerYear) * $rate * 100));
}
} // function PRICEMAT()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::PV (   $rate = 0,
  $nper = 0,
  $pmt = 0,
  $fv = 0,
  $type = 0 
)
static

PV.

Returns the Present Value of a cash flow with constant payments and interest rate (annuities).

Parameters
float$rateInterest rate per period
int$nperNumber of periods
float$pmtPeriodic payment (annuity)
float$fvFuture Value
int$typePayment type: 0 = at the end of each period, 1 = at the beginning of each period
Returns
float

Definition at line 1335 of file Financial.php.

References $type, PHPExcel_Calculation_Functions\flattenSingleValue(), and PHPExcel_Calculation_Functions\NaN().

{
// Validate parameters
if ($type != 0 && $type != 1) {
}
// Calculate
if (!is_null($rate) && $rate != 0) {
return (-$pmt * (1 + $rate * $type) * ((pow(1 + $rate, $nper) - 1) / $rate) - $fv) / pow(1 + $rate, $nper);
} else {
return -$fv - $pmt * $nper;
}
} // function PV()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::RATE (   $nper,
  $pmt,
  $pv,
  $fv = 0.0,
  $type = 0,
  $guess = 0.1 
)
static

RATE.

Definition at line 1360 of file Financial.php.

References $f, $type, $y, FINANCIAL_MAX_ITERATIONS, FINANCIAL_PRECISION, and PHPExcel_Calculation_Functions\flattenSingleValue().

{
$fv = (is_null($fv)) ? 0.0 : PHPExcel_Calculation_Functions::flattenSingleValue($fv);
$guess = (is_null($guess)) ? 0.1 : PHPExcel_Calculation_Functions::flattenSingleValue($guess);
$rate = $guess;
if (abs($rate) < FINANCIAL_PRECISION) {
$y = $pv * (1 + $nper * $rate) + $pmt * (1 + $rate * $type) * $nper + $fv;
} else {
$f = exp($nper * log(1 + $rate));
$y = $pv * $f + $pmt * (1 / $rate + $type) * ($f - 1) + $fv;
}
$y0 = $pv + $pmt * $nper + $fv;
$y1 = $pv * $f + $pmt * (1 / $rate + $type) * ($f - 1) + $fv;
// find root by secant method
$i = $x0 = 0.0;
$x1 = $rate;
while ((abs($y0 - $y1) > FINANCIAL_PRECISION) && ($i < FINANCIAL_MAX_ITERATIONS)) {
$rate = ($y1 * $x0 - $y0 * $x1) / ($y1 - $y0);
$x0 = $x1;
$x1 = $rate;
if (abs($rate) < FINANCIAL_PRECISION) {
$y = $pv * (1 + $nper * $rate) + $pmt * (1 + $rate * $type) * $nper + $fv;
} else {
$f = exp($nper * log(1 + $rate));
$y = $pv * $f + $pmt * (1 / $rate + $type) * ($f - 1) + $fv;
}
$y0 = $y1;
$y1 = $y;
++$i;
}
return $rate;
} // function RATE()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::RECEIVED (   $settlement,
  $maturity,
  $investment,
  $discount,
  $basis = 0 
)
static

RECEIVED.

Returns the price per $100 face value of a discounted security.

Parameters
mixedsettlement The security's settlement date. The security settlement date is the date after the issue date when the security is traded to the buyer.
mixedmaturity The security's maturity date. The maturity date is the date when the security expires.
intinvestment The amount invested in the security.
intdiscount The security's discount rate.
intbasis The type of day count to use. 0 or omitted US (NASD) 30/360 1 Actual/actual 2 Actual/360 3 Actual/365 4 European 30/360
Returns
float

Definition at line 1420 of file Financial.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), PHPExcel_Calculation_Functions\VALUE(), and PHPExcel_Calculation_DateTime\YEARFRAC().

{
$investment = (float) PHPExcel_Calculation_Functions::flattenSingleValue($investment);
// Validate
if ((is_numeric($investment)) && (is_numeric($discount)) && (is_numeric($basis))) {
if (($investment <= 0) || ($discount <= 0)) {
}
$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
}
return $investment / ( 1 - ($discount * $daysBetweenSettlementAndMaturity));
}
} // function RECEIVED()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::SLN (   $cost,
  $salvage,
  $life 
)
static

SLN.

Returns the straight-line depreciation of an asset for one period

Parameters
costInitial cost of the asset
salvageValue at the end of the depreciation
lifeNumber of periods over which the asset is depreciated
Returns
float

Definition at line 1454 of file Financial.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

{
// Calculate
if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life))) {
if ($life < 0) {
}
return ($cost - $salvage) / $life;
}
} // function SLN()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::SYD (   $cost,
  $salvage,
  $life,
  $period 
)
static

SYD.

Returns the sum-of-years' digits depreciation of an asset for a specified period.

Parameters
costInitial cost of the asset
salvageValue at the end of the depreciation
lifeNumber of periods over which the asset is depreciated
periodPeriod
Returns
float

Definition at line 1481 of file Financial.php.

References PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

{
// Calculate
if ((is_numeric($cost)) && (is_numeric($salvage)) && (is_numeric($life)) && (is_numeric($period))) {
if (($life < 1) || ($period > $life)) {
}
return (($cost - $salvage) * ($life - $period + 1) * 2) / ($life * ($life + 1));
}
} // function SYD()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::TBILLEQ (   $settlement,
  $maturity,
  $discount 
)
static

TBILLEQ.

Returns the bond-equivalent yield for a Treasury bill.

Parameters
mixedsettlement The Treasury bill's settlement date. The Treasury bill's settlement date is the date after the issue date when the Treasury bill is traded to the buyer.
mixedmaturity The Treasury bill's maturity date. The maturity date is the date when the Treasury bill expires.
intdiscount The Treasury bill's discount rate.
Returns
float

Definition at line 1510 of file Financial.php.

References PHPExcel_Calculation_DateTime\_getDateValue(), PHPExcel_Calculation_Functions\COMPATIBILITY_OPENOFFICE, PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\getCompatibilityMode(), TBILLPRICE(), PHPExcel_Calculation_Functions\VALUE(), and PHPExcel_Calculation_DateTime\YEARFRAC().

{
// Use TBILLPRICE for validation
$testValue = self::TBILLPRICE($settlement, $maturity, $discount);
if (is_string($testValue)) {
return $testValue;
}
if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) {
}
++$maturity;
$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360;
} else {
$daysBetweenSettlementAndMaturity = (PHPExcel_Calculation_DateTime::_getDateValue($maturity) - PHPExcel_Calculation_DateTime::_getDateValue($settlement));
}
return (365 * $discount) / (360 - $discount * $daysBetweenSettlementAndMaturity);
} // function TBILLEQ()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::TBILLPRICE (   $settlement,
  $maturity,
  $discount 
)
static

TBILLPRICE.

Returns the yield for a Treasury bill.

Parameters
mixedsettlement The Treasury bill's settlement date. The Treasury bill's settlement date is the date after the issue date when the Treasury bill is traded to the buyer.
mixedmaturity The Treasury bill's maturity date. The maturity date is the date when the Treasury bill expires.
intdiscount The Treasury bill's discount rate.
Returns
float

Definition at line 1548 of file Financial.php.

References PHPExcel_Calculation_DateTime\_getDateValue(), PHPExcel_Calculation_Functions\COMPATIBILITY_OPENOFFICE, PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\getCompatibilityMode(), PHPExcel_Calculation_Functions\NaN(), PHPExcel_Calculation_Functions\VALUE(), and PHPExcel_Calculation_DateTime\YEARFRAC().

Referenced by TBILLEQ().

{
if (is_string($maturity = PHPExcel_Calculation_DateTime::_getDateValue($maturity))) {
}
// Validate
if (is_numeric($discount)) {
if ($discount <= 0) {
}
++$maturity;
$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360;
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
}
} else {
$daysBetweenSettlementAndMaturity = (PHPExcel_Calculation_DateTime::_getDateValue($maturity) - PHPExcel_Calculation_DateTime::_getDateValue($settlement));
}
if ($daysBetweenSettlementAndMaturity > 360) {
}
$price = 100 * (1 - (($discount * $daysBetweenSettlementAndMaturity) / 360));
if ($price <= 0) {
}
return $price;
}
} // function TBILLPRICE()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_Financial::TBILLYIELD (   $settlement,
  $maturity,
  $price 
)
static

TBILLYIELD.

Returns the yield for a Treasury bill.

Parameters
mixedsettlement The Treasury bill's settlement date. The Treasury bill's settlement date is the date after the issue date when the Treasury bill is traded to the buyer.
mixedmaturity The Treasury bill's maturity date. The maturity date is the date when the Treasury bill expires.
intprice The Treasury bill's price per $100 face value.
Returns
float

Definition at line 1600 of file Financial.php.

References PHPExcel_Calculation_DateTime\_getDateValue(), PHPExcel_Calculation_Functions\COMPATIBILITY_OPENOFFICE, PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\getCompatibilityMode(), PHPExcel_Calculation_Functions\NaN(), PHPExcel_Calculation_Functions\VALUE(), and PHPExcel_Calculation_DateTime\YEARFRAC().

{
// Validate
if (is_numeric($price)) {
if ($price <= 0) {
}
++$maturity;
$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity) * 360;
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
}
} else {
$daysBetweenSettlementAndMaturity = (PHPExcel_Calculation_DateTime::_getDateValue($maturity) - PHPExcel_Calculation_DateTime::_getDateValue($settlement));
}
if ($daysBetweenSettlementAndMaturity > 360) {
}
return ((100 - $price) / $price) * (360 / $daysBetweenSettlementAndMaturity);
}
} // function TBILLYIELD()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::XIRR (   $values,
  $dates,
  $guess = 0.1 
)
static

Definition at line 1632 of file Financial.php.

References $f, FINANCIAL_MAX_ITERATIONS, FINANCIAL_PRECISION, PHPExcel_Calculation_Functions\flattenArray(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), PHPExcel_Calculation_Functions\VALUE(), and XNPV().

{
if ((!is_array($values)) && (!is_array($dates))) return PHPExcel_Calculation_Functions::VALUE();
if (count($values) != count($dates)) return PHPExcel_Calculation_Functions::NaN();
// create an initial range, with a root somewhere between 0 and guess
$x1 = 0.0;
$x2 = $guess;
$f1 = self::XNPV($x1, $values, $dates);
$f2 = self::XNPV($x2, $values, $dates);
for ($i = 0; $i < FINANCIAL_MAX_ITERATIONS; ++$i) {
if (($f1 * $f2) < 0.0) break;
if (abs($f1) < abs($f2)) {
$f1 = self::XNPV($x1 += 1.6 * ($x1 - $x2), $values, $dates);
} else {
$f2 = self::XNPV($x2 += 1.6 * ($x2 - $x1), $values, $dates);
}
}
if (($f1 * $f2) > 0.0) return PHPExcel_Calculation_Functions::VALUE();
$f = self::XNPV($x1, $values, $dates);
if ($f < 0.0) {
$rtb = $x1;
$dx = $x2 - $x1;
} else {
$rtb = $x2;
$dx = $x1 - $x2;
}
for ($i = 0; $i < FINANCIAL_MAX_ITERATIONS; ++$i) {
$dx *= 0.5;
$x_mid = $rtb + $dx;
$f_mid = self::XNPV($x_mid, $values, $dates);
if ($f_mid <= 0.0) $rtb = $x_mid;
if ((abs($f_mid) < FINANCIAL_PRECISION) || (abs($dx) < FINANCIAL_PRECISION)) return $x_mid;
}
}

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::XNPV (   $rate,
  $values,
  $dates 
)
static

XNPV.

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
float$rateThe discount rate to apply to the cash flows.
arrayof float $values 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.
arrayof mixed $dates 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.
Returns
float

Definition at line 1688 of file Financial.php.

References PHPExcel_Calculation_DateTime\DATEDIF(), PHPExcel_Calculation_Functions\flattenArray(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), and PHPExcel_Calculation_Functions\VALUE().

Referenced by XIRR().

{
if (!is_numeric($rate)) return PHPExcel_Calculation_Functions::VALUE();
if ((!is_array($values)) || (!is_array($dates))) return PHPExcel_Calculation_Functions::VALUE();
$valCount = count($values);
if ($valCount != count($dates)) return PHPExcel_Calculation_Functions::NaN();
if ((min($values) > 0) || (max($values) < 0)) return PHPExcel_Calculation_Functions::VALUE();
$xnpv = 0.0;
for ($i = 0; $i < $valCount; ++$i) {
if (!is_numeric($values[$i])) return PHPExcel_Calculation_Functions::VALUE();
$xnpv += $values[$i] / pow(1 + $rate, PHPExcel_Calculation_DateTime::DATEDIF($dates[0],$dates[$i],'d') / 365);
}
return (is_finite($xnpv)) ? $xnpv : PHPExcel_Calculation_Functions::VALUE();
} // function XNPV()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static PHPExcel_Calculation_Financial::YIELDDISC (   $settlement,
  $maturity,
  $price,
  $redemption,
  $basis = 0 
)
static

YIELDDISC.

Returns the annual yield of a security that pays interest at maturity.

Parameters
mixedsettlement The security's settlement date. The security's settlement date is the date after the issue date when the security is traded to the buyer.
mixedmaturity The security's maturity date. The maturity date is the date when the security expires.
intprice The security's price per $100 face value.
intredemption The security's redemption value per $100 face value.
intbasis The type of day count to use. 0 or omitted US (NASD) 30/360 1 Actual/actual 2 Actual/360 3 Actual/365 4 European 30/360
Returns
float

Definition at line 1726 of file Financial.php.

References _daysPerYear(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), PHPExcel_Calculation_Functions\VALUE(), PHPExcel_Calculation_DateTime\YEAR(), and PHPExcel_Calculation_DateTime\YEARFRAC().

{
// Validate
if (is_numeric($price) && is_numeric($redemption)) {
if (($price <= 0) || ($redemption <= 0)) {
}
$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement),$basis);
if (!is_numeric($daysPerYear)) {
return $daysPerYear;
}
$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity,$basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
}
$daysBetweenSettlementAndMaturity *= $daysPerYear;
return (($redemption - $price) / $price) * ($daysPerYear / $daysBetweenSettlementAndMaturity);
}
} // function YIELDDISC()

+ Here is the call graph for this function:

static PHPExcel_Calculation_Financial::YIELDMAT (   $settlement,
  $maturity,
  $issue,
  $rate,
  $price,
  $basis = 0 
)
static

YIELDMAT.

Returns the annual yield of a security that pays interest at maturity.

Parameters
mixedsettlement The security's settlement date. The security's settlement date is the date after the issue date when the security is traded to the buyer.
mixedmaturity The security's maturity date. The maturity date is the date when the security expires.
mixedissue The security's issue date.
intrate The security's interest rate at date of issue.
intprice The security's price per $100 face value.
intbasis The type of day count to use. 0 or omitted US (NASD) 30/360 1 Actual/actual 2 Actual/360 3 Actual/365 4 European 30/360
Returns
float

Definition at line 1775 of file Financial.php.

References _daysPerYear(), PHPExcel_Calculation_Functions\flattenSingleValue(), PHPExcel_Calculation_Functions\NaN(), PHPExcel_Calculation_Functions\VALUE(), PHPExcel_Calculation_DateTime\YEAR(), and PHPExcel_Calculation_DateTime\YEARFRAC().

{
// Validate
if (is_numeric($rate) && is_numeric($price)) {
if (($rate <= 0) || ($price <= 0)) {
}
$daysPerYear = self::_daysPerYear(PHPExcel_Calculation_DateTime::YEAR($settlement),$basis);
if (!is_numeric($daysPerYear)) {
return $daysPerYear;
}
$daysBetweenIssueAndSettlement = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $settlement, $basis);
if (!is_numeric($daysBetweenIssueAndSettlement)) {
// return date error
return $daysBetweenIssueAndSettlement;
}
$daysBetweenIssueAndSettlement *= $daysPerYear;
$daysBetweenIssueAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($issue, $maturity, $basis);
if (!is_numeric($daysBetweenIssueAndMaturity)) {
// return date error
return $daysBetweenIssueAndMaturity;
}
$daysBetweenIssueAndMaturity *= $daysPerYear;
$daysBetweenSettlementAndMaturity = PHPExcel_Calculation_DateTime::YEARFRAC($settlement, $maturity, $basis);
if (!is_numeric($daysBetweenSettlementAndMaturity)) {
// return date error
return $daysBetweenSettlementAndMaturity;
}
$daysBetweenSettlementAndMaturity *= $daysPerYear;
return ((1 + (($daysBetweenIssueAndMaturity / $daysPerYear) * $rate) - (($price / 100) + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate))) /
(($price / 100) + (($daysBetweenIssueAndSettlement / $daysPerYear) * $rate))) *
($daysPerYear / $daysBetweenSettlementAndMaturity);
}
} // function YIELDMAT()

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: