Math_Finance
[ class tree: Math_Finance ] [ index: Math_Finance ] [ all elements ]

Class: Math_Finance

Source Location: /Math_Finance-1.0.1/Math/Finance.php

Class Overview


Math_Finance: Main class


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2005 Alejandro Pedraza

Methods


Inherited Variables

Inherited Methods


Class Details

[line 58]
Math_Finance: Main class


[ Top ]


Method Detail

daysDifference   [line 590]

int daysDifference( int $date1, int $date2, int $basis)

Returns the difference of days between two dates based on a daycount basis
  • Access: public

Parameters:

int   $date1   —  First date (UNIX timestamp)
int   $date2   —  Second date (UNIX timestamp)
int   $basis   —  Type of day count basis:

[ Top ]

daysPerYear   [line 631]

int daysPerYear( int $year, int $basis)

Returns the number of days in the year based on a daycount basis
  • Access: public

Parameters:

int   $year   —  Year
int   $basis   —  Type of day count basis:

[ Top ]

depreciationFixedDeclining   [line 802]

float depreciationFixedDeclining( float $cost, float $salvage, int $life, int $period, [ $month = 12])

Returns the depreciation of an asset using the fixed-declining balance method Excel equivalent: DB
  • Access: public

Parameters:

float   $cost   —  The initial cost of the asset
float   $salvage   —  Salvage value of the asset
int   $life   —  Number of depreciation periods (same unit as $life)
int   $period   —  Number of months in the first year, defaults to 12
   $month   — 

[ Top ]

depreciationStraightLine   [line 845]

float depreciationStraightLine( float $cost, float $salvage, int $life)

Returns the straight-line depreciation of an asset for each period Excel equivalent: SLN
  • Access: public

Parameters:

float   $cost   —  The initial cost of the asset
float   $salvage   —  Salvage value of the asset
int   $life   —  Number of depreciation periods

[ Top ]

depreciationSYD   [line 867]

float depreciationSYD( float $cost, float $salvage, int $life, int $per)

Returns the depreciation for an asset in a given period using the sum-of-years' digits method Excel equivalent: SYD
  • Access: public

Parameters:

float   $cost   —  The initial cost of the asset
float   $salvage   —  Salvage value of the asset
int   $life   —  Number of depreciation periods
int   $per   —  Period (must be in the same unit as $life)

[ Top ]

discountRate   [line 751]

float discountRate( int $settlement, int $maturity, float $pr, float $redemption, [int $basis = 0])

Returns the discount rate for a bond Excel equivalent: DISC
  • Access: public

Parameters:

int   $settlement   —  Settlement date (UNIX timestamp)
int   $maturity   —  Maturity date (UNIX timestamp)
float   $pr   —  The bond's price per $100 face value
float   $redemption   —  The bond's redemption value per $100 face value
int   $basis   —  Type of day count basis:

[ Top ]

effectiveRate   [line 74]

float effectiveRate( float $nominal_rate, int $npery)

Returns the effective interest rate given the nominal rate and the number of compounding payments per year Excel equivalent: EFFECT
  • Access: public

Parameters:

float   $nominal_rate   —  Nominal interest rate
int   $npery   —  Number of compounding payments per year

[ Top ]

futureValue   [line 162]

float futureValue( float $rate, int $nper, float $pmt, [float $pv = 0], [int $type = 0])

Returns the Future Value of a cash flow with constant payments and interest rate (annuities) Excel equivalent: FV
  • Access: public

Parameters:

float   $rate   —  Interest rate per period
int   $nper   —  Number of periods
float   $pmt   —  Periodic payment (annuity)
float   $pv   —  Present Value
int   $type   —  Payment type:

[ Top ]

interestPayment   [line 354]

float interestPayment( float $rate, int $per, int $nper, float $pv, [float $fv = 0], [int $type = 0])

Returns the interest payment for a given period for a cash flow with constant periodic payments (annuities) and interest rate.

Excel equivalent: IMPT

  • Access: public

Parameters:

float   $rate   —  Interest rate per period
int   $per   —  Period for which the interest payment will be calculated
int   $nper   —  Number of periods
float   $pv   —  Present Value
float   $fv   —  Future Value
int   $type   —  Payment type:

[ Top ]

internalRateOfReturn   [line 455]

float internalRateOfReturn( array $values, [float $guess = 0.1])

Returns the internal rate of return of a cash flow series Excel equivalent: IRR
  • Access: public

Parameters:

array   $values   —  Cash flow series
float   $guess   —  guess for the interest rate

[ Top ]

modifiedInternalRateOfReturn   [line 545]

float modifiedInternalRateOfReturn( array $values, float $finance_rate, float $reinvest_rate)

Returns the internal rate of return of a cash flow series, considering both financial and reinvestment rates Excel equivalent: MIRR
  • Access: public

Parameters:

array   $values   —  Cash flow series
float   $finance_rate   —  Interest rate on the money used in the cash flow
float   $reinvest_rate   —  Interest rate received when reinvested

[ Top ]

netPresentValue   [line 436]

float netPresentValue( float $rate, array $values)

Returns the Net Present Value of a cash flow series given a discount rate Excel equivalent: NPV
  • Access: public

Parameters:

float   $rate   —  Discount interest rate
array   $values   —  Cash flow series

[ Top ]

nominalRate   [line 95]

float nominalRate( float $effect_rate, int $npery)

Returns the nominal interest rate given the effective rate and the number of compounding payments per year Excel equivalent: NOMINAL
  • Access: public

Parameters:

float   $effect_rate   —  Effective interest rate
int   $npery   —  Number of compounding payments per year

[ Top ]

payment   [line 194]

float payment( float $rate, int $nper, float $pv, [float $fv = 0], [int $type = 0])

Returns the constant payment (annuity) for a cash flow with a constant interest rate Excel equivalent: PMT
  • Access: public

Parameters:

float   $rate   —  Interest rate per period
int   $nper   —  Number of periods
float   $pv   —  Present Value
float   $fv   —  Future Value
int   $type   —  Payment type:

[ Top ]

periods   [line 226]

float periods( float $rate, float $pmt, float $pv, [float $fv = 0], [int $type = 0])

Returns the number of periods for a cash flow with constant periodic payments (annuities), and interest rate Excel equivalent: NPER
  • Access: public

Parameters:

float   $rate   —  Interest rate per period
float   $pmt   —  Periodic payment (annuity)
float   $pv   —  Present Value
float   $fv   —  Future Value
int   $type   —  Payment type:

[ Top ]

presentValue   [line 130]

float presentValue( float $rate, int $nper, float $pmt, [float $fv = 0], [int $type = 0])

Returns the Present Value of a cash flow with constant payments and interest rate (annuities) Excel equivalent: PV

TVM functions solve for a term in the following formula: pv(1+r)^n + pmt(1+r.type)((1+r)^n - 1)/r) +fv = 0

  • Access: public

Parameters:

float   $rate   —  Interest rate per period
int   $nper   —  Number of periods
float   $pmt   —  Periodic payment (annuity)
float   $fv   —  Future Value
int   $type   —  Payment type:

[ Top ]

priceDiscount   [line 777]

float priceDiscount( int $settlement, int $maturity, float $discount, float $redemption, [int $basis = 0])

Returns the price per $100 face value of a discounted bond Excel equivalent: PRICEDISC
  • Access: public

Parameters:

int   $settlement   —  Settlement date (UNIX timestamp)
int   $maturity   —  Maturity date (UNIX timestamp)
float   $discount   —  The bond's discount rate
float   $redemption   —  The bond's redemption value per $100 face value
int   $basis   —  Type of day count basis:

[ Top ]

principalPayment   [line 381]

float principalPayment( float $rate, int $per, int $nper, float $pv, [float $fv = 0], [int $type = 0])

Returns the principal payment for a given period for a cash flow with constant periodic payments (annuities) and interest rate Excel equivalent: PPMT
  • Access: public

Parameters:

float   $rate   —  Interest rate per period
int   $per   —  Period for which the principal payment will be calculated
int   $nper   —  Number of periods
float   $pv   —  Present Value
float   $fv   —  Future Value
int   $type   —  Payment type:

[ Top ]

rate   [line 263]

float rate( int $nper, float $pmt, float $pv, [float $fv = 0], [int $type = 0], [float $guess = 0.1])

Returns the periodic interest rate for a cash flow with constant periodic payments (annuities) Excel equivalent: RATE
  • Access: public

Parameters:

int   $nper   —  Number of periods
float   $pmt   —  Periodic payment (annuity)
float   $pv   —  Present Value
float   $fv   —  Future Value
int   $type   —  Payment type:
float   $guess   —  guess for the interest rate

[ Top ]

TBillEquivalentYield   [line 710]

float TBillEquivalentYield( int $settlement, int $maturity, float $discount)

Returns the bond-equivalent yield for a Treasury bill Excel equivalent: TBILLEQ
  • Access: public

Parameters:

int   $settlement   —  Settlement date (UNIX timestamp)
int   $maturity   —  Maturity date (UNIX timestamp)
float   $discount   —  T-Bill discount rate

[ Top ]

TBillPrice   [line 684]

float TBillPrice( int $settlement, int $maturity, float $discount)

Returns the price per $100 face value for a Treasury bill Excel equivalent: TBILLPRICE
  • Access: public

Parameters:

int   $settlement   —  Settlement date (UNIX timestamp)
int   $maturity   —  Maturity date (UNIX timestamp)
float   $discount   —  T-Bill discount rate

[ Top ]

TBillYield   [line 658]

float TBillYield( int $settlement, int $maturity, float $pr)

Returns the yield for a treasury bill Excel equivalent: TBILLYIELD
  • Access: public

Parameters:

int   $settlement   —  Settlement date (UNIX timestamp)
int   $maturity   —  Maturity date (UNIX timestamp)
float   $pr   —  TBill price per $100 face value

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:40:20 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.