ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Financial.php
Go to the documentation of this file.
1 <?php
2 
4 
12 
16 class Financial
17 {
19 
20  const FINANCIAL_PRECISION = 1.0e-08;
21 
60  public static function ACCRINT(
61  $issue,
62  $firstInterest,
63  $settlement,
64  $rate,
65  $parValue = 1000,
66  $frequency = 1,
67  $basis = 0,
68  $calcMethod = true
69  ) {
71  $issue,
72  $firstInterest,
73  $settlement,
74  $rate,
75  $parValue,
76  $frequency,
77  $basis,
78  $calcMethod
79  );
80  }
81 
109  public static function ACCRINTM($issue, $settlement, $rate, $parValue = 1000, $basis = 0)
110  {
111  return Securities\AccruedInterest::atMaturity($issue, $settlement, $rate, $parValue, $basis);
112  }
113 
149  public static function AMORDEGRC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis = 0)
150  {
151  return Amortization::AMORDEGRC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis);
152  }
153 
184  public static function AMORLINC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis = 0)
185  {
186  return Amortization::AMORLINC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis);
187  }
188 
221  public static function COUPDAYBS($settlement, $maturity, $frequency, $basis = 0)
222  {
223  return Coupons::COUPDAYBS($settlement, $maturity, $frequency, $basis);
224  }
225 
258  public static function COUPDAYS($settlement, $maturity, $frequency, $basis = 0)
259  {
260  return Coupons::COUPDAYS($settlement, $maturity, $frequency, $basis);
261  }
262 
295  public static function COUPDAYSNC($settlement, $maturity, $frequency, $basis = 0)
296  {
297  return Coupons::COUPDAYSNC($settlement, $maturity, $frequency, $basis);
298  }
299 
333  public static function COUPNCD($settlement, $maturity, $frequency, $basis = 0)
334  {
335  return Coupons::COUPNCD($settlement, $maturity, $frequency, $basis);
336  }
337 
371  public static function COUPNUM($settlement, $maturity, $frequency, $basis = 0)
372  {
373  return Coupons::COUPNUM($settlement, $maturity, $frequency, $basis);
374  }
375 
409  public static function COUPPCD($settlement, $maturity, $frequency, $basis = 0)
410  {
411  return Coupons::COUPPCD($settlement, $maturity, $frequency, $basis);
412  }
413 
439  public static function CUMIPMT($rate, $nper, $pv, $start, $end, $type = 0)
440  {
442  }
443 
469  public static function CUMPRINC($rate, $nper, $pv, $start, $end, $type = 0)
470  {
472  }
473 
504  public static function DB($cost, $salvage, $life, $period, $month = 12)
505  {
506  return Depreciation::DB($cost, $salvage, $life, $period, $month);
507  }
508 
536  public static function DDB($cost, $salvage, $life, $period, $factor = 2.0)
537  {
538  return Depreciation::DDB($cost, $salvage, $life, $period, $factor);
539  }
540 
570  public static function DISC($settlement, $maturity, $price, $redemption, $basis = 0)
571  {
572  return Financial\Securities\Rates::discount($settlement, $maturity, $price, $redemption, $basis);
573  }
574 
595  public static function DOLLARDE($fractional_dollar = null, $fraction = 0)
596  {
597  return Dollar::decimal($fractional_dollar, $fraction);
598  }
599 
620  public static function DOLLARFR($decimal_dollar = null, $fraction = 0)
621  {
622  return Dollar::fractional($decimal_dollar, $fraction);
623  }
624 
644  public static function EFFECT($nominalRate = 0, $periodsPerYear = 0)
645  {
646  return Financial\InterestRate::effective($nominalRate, $periodsPerYear);
647  }
648 
675  public static function FV($rate = 0, $nper = 0, $pmt = 0, $pv = 0, $type = 0)
676  {
677  return Financial\CashFlow\Constant\Periodic::futureValue($rate, $nper, $pmt, $pv, $type);
678  }
679 
699  public static function FVSCHEDULE($principal, $schedule)
700  {
701  return Financial\CashFlow\Single::futureValue($principal, $schedule);
702  }
703 
733  public static function INTRATE($settlement, $maturity, $investment, $redemption, $basis = 0)
734  {
735  return Financial\Securities\Rates::interest($settlement, $maturity, $investment, $redemption, $basis);
736  }
737 
761  public static function IPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0)
762  {
763  return Financial\CashFlow\Constant\Periodic\Interest::payment($rate, $per, $nper, $pv, $fv, $type);
764  }
765 
791  public static function IRR($values, $guess = 0.1)
792  {
794  }
795 
817  public static function ISPMT(...$args)
818  {
820  }
821 
844  public static function MIRR($values, $finance_rate, $reinvestment_rate)
845  {
846  return Financial\CashFlow\Variable\Periodic::modifiedRate($values, $finance_rate, $reinvestment_rate);
847  }
848 
867  public static function NOMINAL($effectiveRate = 0, $periodsPerYear = 0)
868  {
869  return InterestRate::nominal($effectiveRate, $periodsPerYear);
870  }
871 
890  public static function NPER($rate = 0, $pmt = 0, $pv = 0, $fv = 0, $type = 0)
891  {
892  return Financial\CashFlow\Constant\Periodic::periods($rate, $pmt, $pv, $fv, $type);
893  }
894 
907  public static function NPV(...$args)
908  {
910  }
911 
928  public static function PDURATION($rate = 0, $pv = 0, $fv = 0)
929  {
930  return Financial\CashFlow\Single::periods($rate, $pv, $fv);
931  }
932 
951  public static function PMT($rate = 0, $nper = 0, $pv = 0, $fv = 0, $type = 0)
952  {
953  return Financial\CashFlow\Constant\Periodic\Payments::annuity($rate, $nper, $pv, $fv, $type);
954  }
955 
976  public static function PPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0)
977  {
978  return Financial\CashFlow\Constant\Periodic\Payments::interestPayment($rate, $per, $nper, $pv, $fv, $type);
979  }
980 
1012  public static function PRICE($settlement, $maturity, $rate, $yield, $redemption, $frequency, $basis = 0)
1013  {
1014  return Securities\Price::price($settlement, $maturity, $rate, $yield, $redemption, $frequency, $basis);
1015  }
1016 
1043  public static function PRICEDISC($settlement, $maturity, $discount, $redemption, $basis = 0)
1044  {
1045  return Securities\Price::priceDiscounted($settlement, $maturity, $discount, $redemption, $basis);
1046  }
1047 
1075  public static function PRICEMAT($settlement, $maturity, $issue, $rate, $yield, $basis = 0)
1076  {
1077  return Securities\Price::priceAtMaturity($settlement, $maturity, $issue, $rate, $yield, $basis);
1078  }
1079 
1098  public static function PV($rate = 0, $nper = 0, $pmt = 0, $fv = 0, $type = 0)
1099  {
1100  return Financial\CashFlow\Constant\Periodic::presentValue($rate, $nper, $pmt, $fv, $type);
1101  }
1102 
1137  public static function RATE($nper, $pmt, $pv, $fv = 0.0, $type = 0, $guess = 0.1)
1138  {
1139  return Financial\CashFlow\Constant\Periodic\Interest::rate($nper, $pmt, $pv, $fv, $type, $guess);
1140  }
1141 
1168  public static function RECEIVED($settlement, $maturity, $investment, $discount, $basis = 0)
1169  {
1170  return Financial\Securities\Price::received($settlement, $maturity, $investment, $discount, $basis);
1171  }
1172 
1189  public static function RRI($nper = 0, $pv = 0, $fv = 0)
1190  {
1191  return Financial\CashFlow\Single::interestRate($nper, $pv, $fv);
1192  }
1193 
1210  public static function SLN($cost, $salvage, $life)
1211  {
1212  return Depreciation::SLN($cost, $salvage, $life);
1213  }
1214 
1232  public static function SYD($cost, $salvage, $life, $period)
1233  {
1234  return Depreciation::SYD($cost, $salvage, $life, $period);
1235  }
1236 
1256  public static function TBILLEQ($settlement, $maturity, $discount)
1257  {
1258  return TreasuryBill::bondEquivalentYield($settlement, $maturity, $discount);
1259  }
1260 
1280  public static function TBILLPRICE($settlement, $maturity, $discount)
1281  {
1282  return TreasuryBill::price($settlement, $maturity, $discount);
1283  }
1284 
1304  public static function TBILLYIELD($settlement, $maturity, $price)
1305  {
1306  return TreasuryBill::yield($settlement, $maturity, $price);
1307  }
1308 
1331  public static function XIRR($values, $dates, $guess = 0.1)
1332  {
1334  }
1335 
1363  public static function XNPV($rate, $values, $dates)
1364  {
1366  }
1367 
1394  public static function YIELDDISC($settlement, $maturity, $price, $redemption, $basis = 0)
1395  {
1396  return Securities\Yields::yieldDiscounted($settlement, $maturity, $price, $redemption, $basis);
1397  }
1398 
1426  public static function YIELDMAT($settlement, $maturity, $issue, $rate, $price, $basis = 0)
1427  {
1428  return Securities\Yields::yieldAtMaturity($settlement, $maturity, $issue, $rate, $price, $basis);
1429  }
1430 }
static schedulePayment($interestRate, $period, $numberOfPeriods, $principleRemaining)
ISPMT.
Definition: Interest.php:91
static fractional($decimalDollar=null, $fraction=0)
DOLLARFR.
Definition: Dollar.php:77
static DOLLARFR($decimal_dollar=null, $fraction=0)
DOLLARFR.
Definition: Financial.php:620
static AMORLINC( $cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
AMORLINC.
static presentValue( $rate, $numberOfPeriods, $payment=0.0, $futureValue=0.0, $type=FinancialConstants::PAYMENT_END_OF_PERIOD)
PV.
Definition: Periodic.php:72
static atMaturity( $issue, $settlement, $rate, $parValue=1000, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
ACCRINTM.
static SLN($cost, $salvage, $life)
SLN.
Definition: Financial.php:1210
static PDURATION($rate=0, $pv=0, $fv=0)
PDURATION.
Definition: Financial.php:928
static futureValue( $rate, $numberOfPeriods, $payment=0.0, $presentValue=0.0, $type=FinancialConstants::PAYMENT_END_OF_PERIOD)
FV.
Definition: Periodic.php:33
static discount( $settlement, $maturity, $price, $redemption, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
DISC.
Definition: Rates.php:36
static COUPDAYBS($settlement, $maturity, $frequency, $basis=0)
COUPDAYBS.
Definition: Financial.php:221
static MIRR($values, $finance_rate, $reinvestment_rate)
MIRR.
Definition: Financial.php:844
static ACCRINTM($issue, $settlement, $rate, $parValue=1000, $basis=0)
ACCRINTM.
Definition: Financial.php:109
static PPMT($rate, $per, $nper, $pv, $fv=0, $type=0)
PPMT.
Definition: Financial.php:976
static periods($rate, $presentValue, $futureValue)
PDURATION.
Definition: Single.php:54
$type
static yieldAtMaturity( $settlement, $maturity, $issue, $rate, $price, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
YIELDMAT.
Definition: Yields.php:96
static COUPDAYSNC( $settlement, $maturity, $frequency, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
COUPDAYSNC.
Definition: Coupons.php:178
static YIELDDISC($settlement, $maturity, $price, $redemption, $basis=0)
YIELDDISC.
Definition: Financial.php:1394
static RATE($nper, $pmt, $pv, $fv=0.0, $type=0, $guess=0.1)
RATE.
Definition: Financial.php:1137
static annuity( $interestRate, $numberOfPeriods, $presentValue, $futureValue=0, $type=FinancialConstants::PAYMENT_END_OF_PERIOD)
PMT.
Definition: Payments.php:25
static PV($rate=0, $nper=0, $pmt=0, $fv=0, $type=0)
PV.
Definition: Financial.php:1098
static principal( $rate, $periods, $presentValue, $start, $end, $type=FinancialConstants::PAYMENT_END_OF_PERIOD)
CUMPRINC.
Definition: Cumulative.php:97
static interestRate($periods=0.0, $presentValue=0.0, $futureValue=0.0)
RRI.
Definition: Single.php:87
static TBILLEQ($settlement, $maturity, $discount)
TBILLEQ.
Definition: Financial.php:1256
static COUPPCD($settlement, $maturity, $frequency, $basis=0)
COUPPCD.
Definition: Financial.php:409
static nominal($effectiveRate=0, $periodsPerYear=0)
NOMINAL.
static TBILLPRICE($settlement, $maturity, $discount)
TBILLPRICE.
Definition: Financial.php:1280
static DDB($cost, $salvage, $life, $period, $factor=2.0)
DDB.
Definition: Financial.php:536
static IPMT($rate, $per, $nper, $pv, $fv=0, $type=0)
IPMT.
Definition: Financial.php:761
static COUPNCD( $settlement, $maturity, $frequency, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
COUPNCD.
Definition: Coupons.php:243
static COUPDAYS( $settlement, $maturity, $frequency, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
COUPDAYS.
Definition: Coupons.php:107
static bondEquivalentYield($settlement, $maturity, $discount)
TBILLEQ.
static futureValue($principal, $schedule)
FVSCHEDULE.
Definition: Single.php:24
static INTRATE($settlement, $maturity, $investment, $redemption, $basis=0)
INTRATE.
Definition: Financial.php:733
static SYD($cost, $salvage, $life, $period)
SYD.
static XNPV($rate, $values, $dates)
XNPV.
Definition: Financial.php:1363
static ACCRINT( $issue, $firstInterest, $settlement, $rate, $parValue=1000, $frequency=1, $basis=0, $calcMethod=true)
ACCRINT.
Definition: Financial.php:60
$start
Definition: bench.php:8
static rate( $numberOfPeriods, $payment, $presentValue, $futureValue=0.0, $type=FinancialConstants::PAYMENT_END_OF_PERIOD, $guess=0.1)
RATE.
Definition: Interest.php:155
static AMORDEGRC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=0)
AMORDEGRC.
Definition: Financial.php:149
static SYD($cost, $salvage, $life, $period)
SYD.
Definition: Financial.php:1232
static CUMIPMT($rate, $nper, $pv, $start, $end, $type=0)
CUMIPMT.
Definition: Financial.php:439
static NPER($rate=0, $pmt=0, $pv=0, $fv=0, $type=0)
NPER.
Definition: Financial.php:890
static COUPNUM($settlement, $maturity, $frequency, $basis=0)
COUPNUM.
Definition: Financial.php:371
static NOMINAL($effectiveRate=0, $periodsPerYear=0)
NOMINAL.
Definition: Financial.php:867
$values
static payment( $interestRate, $period, $numberOfPeriods, $presentValue, $futureValue=0, $type=FinancialConstants::PAYMENT_END_OF_PERIOD)
IPMT.
Definition: Interest.php:34
static COUPDAYS($settlement, $maturity, $frequency, $basis=0)
COUPDAYS.
Definition: Financial.php:258
static IRR($values, $guess=0.1)
IRR.
Definition: Financial.php:791
static EFFECT($nominalRate=0, $periodsPerYear=0)
EFFECT.
Definition: Financial.php:644
static DB($cost, $salvage, $life, $period, $month=12)
DB.
static yieldDiscounted( $settlement, $maturity, $price, $redemption, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
YIELDDISC.
Definition: Yields.php:34
static price( $settlement, $maturity, $rate, $yield, $redemption, $frequency, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
PRICE.
Definition: Price.php:40
static AMORLINC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=0)
AMORLINC.
Definition: Financial.php:184
static interestPayment( $interestRate, $period, $numberOfPeriods, $presentValue, $futureValue=0, $type=FinancialConstants::PAYMENT_END_OF_PERIOD)
PPMT.
Definition: Payments.php:72
static DOLLARDE($fractional_dollar=null, $fraction=0)
DOLLARDE.
Definition: Financial.php:595
static periodic( $issue, $firstInterest, $settlement, $rate, $parValue=1000, $frequency=FinancialConstants::FREQUENCY_ANNUAL, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD, $calcMethod=self::ACCRINT_CALCMODE_ISSUE_TO_SETTLEMENT)
ACCRINT.
static XIRR($values, $dates, $guess=0.1)
XIRR.
Definition: Financial.php:1331
static received( $settlement, $maturity, $investment, $discount, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
RECEIVED.
Definition: Price.php:246
static periods( $rate, $payment, $presentValue, $futureValue=0.0, $type=FinancialConstants::PAYMENT_END_OF_PERIOD)
NPER.
Definition: Periodic.php:116
static PMT($rate=0, $nper=0, $pv=0, $fv=0, $type=0)
PMT.
Definition: Financial.php:951
static DDB($cost, $salvage, $life, $period, $factor=2.0)
DDB.
static AMORDEGRC( $cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
AMORDEGRC.
static PRICEDISC($settlement, $maturity, $discount, $redemption, $basis=0)
PRICEDISC.
Definition: Financial.php:1043
static interest( $rate, $periods, $presentValue, $start, $end, $type=FinancialConstants::PAYMENT_END_OF_PERIOD)
CUMIPMT.
Definition: Cumulative.php:32
static priceDiscounted( $settlement, $maturity, $discount, $redemption, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
PRICEDISC.
Definition: Price.php:111
static FVSCHEDULE($principal, $schedule)
FVSCHEDULE.
Definition: Financial.php:699
static RECEIVED($settlement, $maturity, $investment, $discount, $basis=0)
RECEIVED.
Definition: Financial.php:1168
static COUPPCD( $settlement, $maturity, $frequency, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
COUPPCD.
Definition: Coupons.php:357
static DB($cost, $salvage, $life, $period, $month=12)
DB.
Definition: Financial.php:504
static effective($nominalRate=0, $periodsPerYear=0)
EFFECT.
static CUMPRINC($rate, $nper, $pv, $start, $end, $type=0)
CUMPRINC.
Definition: Financial.php:469
static decimal($fractionalDollar=null, $fraction=0)
DOLLARDE.
Definition: Dollar.php:41
static modifiedRate($values, $financeRate, $reinvestmentRate)
MIRR.
Definition: Periodic.php:101
static PRICEMAT($settlement, $maturity, $issue, $rate, $yield, $basis=0)
PRICEMAT.
Definition: Financial.php:1075
static yield($settlement, $maturity, $price)
TBILLYIELD.
static TBILLYIELD($settlement, $maturity, $price)
TBILLYIELD.
Definition: Financial.php:1304
static COUPNUM( $settlement, $maturity, $frequency, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
COUPNUM.
Definition: Coupons.php:297
static COUPNCD($settlement, $maturity, $frequency, $basis=0)
COUPNCD.
Definition: Financial.php:333
static price($settlement, $maturity, $discount)
TBILLPRICE.
static PRICE($settlement, $maturity, $rate, $yield, $redemption, $frequency, $basis=0)
PRICE.
Definition: Financial.php:1012
static COUPDAYBS( $settlement, $maturity, $frequency, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
COUPDAYBS.
Definition: Coupons.php:44
static YIELDMAT($settlement, $maturity, $issue, $rate, $price, $basis=0)
YIELDMAT.
Definition: Financial.php:1426
static COUPDAYSNC($settlement, $maturity, $frequency, $basis=0)
COUPDAYSNC.
Definition: Financial.php:295
static RRI($nper=0, $pv=0, $fv=0)
RRI.
Definition: Financial.php:1189
static DISC($settlement, $maturity, $price, $redemption, $basis=0)
DISC.
Definition: Financial.php:570
static interest( $settlement, $maturity, $investment, $redemption, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
INTRATE.
Definition: Rates.php:99
static FV($rate=0, $nper=0, $pmt=0, $pv=0, $type=0)
FV.
Definition: Financial.php:675
static priceAtMaturity( $settlement, $maturity, $issue, $rate, $yield, $basis=FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)
PRICEMAT.
Definition: Price.php:168