Financial.php
60.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
<?php
namespace PhpOffice\PhpSpreadsheet\Calculation;
use PhpOffice\PhpSpreadsheet\Calculation\Financial\Amortization;
use PhpOffice\PhpSpreadsheet\Calculation\Financial\Coupons;
use PhpOffice\PhpSpreadsheet\Calculation\Financial\Depreciation;
use PhpOffice\PhpSpreadsheet\Calculation\Financial\Dollar;
use PhpOffice\PhpSpreadsheet\Calculation\Financial\InterestRate;
use PhpOffice\PhpSpreadsheet\Calculation\Financial\Securities;
use PhpOffice\PhpSpreadsheet\Calculation\Financial\TreasuryBill;
/**
* @deprecated 1.18.0
*/
class Financial
{
const FINANCIAL_MAX_ITERATIONS = 128;
const FINANCIAL_PRECISION = 1.0e-08;
/**
* ACCRINT.
*
* Returns the accrued interest for a security that pays periodic interest.
*
* Excel Function:
* ACCRINT(issue,firstinterest,settlement,rate,par,frequency[,basis][,calc_method])
*
* @Deprecated 1.18.0
*
* @see Financial\Securities\AccruedInterest::periodic()
* Use the periodic() method in the Financial\Securities\AccruedInterest class instead
*
* @param mixed $issue the security's issue date
* @param mixed $firstInterest the security's first interest date
* @param mixed $settlement The security's settlement date.
* The security settlement date is the date after the issue date
* when the security is traded to the buyer.
* @param mixed $rate the security's annual coupon rate
* @param mixed $parValue The security's par value.
* If you omit par, ACCRINT uses $1,000.
* @param mixed $frequency The number of coupon payments per year.
* Valid frequency values are:
* 1 Annual
* 2 Semi-Annual
* 4 Quarterly
* @param mixed $basis 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
* @param mixed $calcMethod
* If true, use Issue to Settlement
* If false, use FirstInterest to Settlement
*
* @return float|string Result, or a string containing an error
*/
public static function ACCRINT(
$issue,
$firstInterest,
$settlement,
$rate,
$parValue = 1000,
$frequency = 1,
$basis = 0,
$calcMethod = true
) {
return Securities\AccruedInterest::periodic(
$issue,
$firstInterest,
$settlement,
$rate,
$parValue,
$frequency,
$basis,
$calcMethod
);
}
/**
* ACCRINTM.
*
* Returns the accrued interest for a security that pays interest at maturity.
*
* Excel Function:
* ACCRINTM(issue,settlement,rate[,par[,basis]])
*
* @Deprecated 1.18.0
*
* @see Financial\Securities\AccruedInterest::atMaturity()
* Use the atMaturity() method in the Financial\Securities\AccruedInterest class instead
*
* @param mixed $issue The security's issue date
* @param mixed $settlement The security's settlement (or maturity) date
* @param mixed $rate The security's annual coupon rate
* @param mixed $parValue The security's par value.
* If you omit par, ACCRINT uses $1,000.
* @param mixed $basis 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
*
* @return float|string Result, or a string containing an error
*/
public static function ACCRINTM($issue, $settlement, $rate, $parValue = 1000, $basis = 0)
{
return Securities\AccruedInterest::atMaturity($issue, $settlement, $rate, $parValue, $basis);
}
/**
* AMORDEGRC.
*
* Returns the depreciation for each accounting period.
* This function is provided for the French accounting system. If an asset is purchased in
* the middle of the accounting period, the prorated depreciation is taken into account.
* The function is similar to AMORLINC, except that a depreciation coefficient is applied in
* the calculation depending on the life of the assets.
* This function will return the depreciation until the last period of the life of the assets
* or until the cumulated value of depreciation is greater than the cost of the assets minus
* the salvage value.
*
* Excel Function:
* AMORDEGRC(cost,purchased,firstPeriod,salvage,period,rate[,basis])
*
* @Deprecated 1.18.0
*
* @see Financial\Amortization::AMORDEGRC()
* Use the AMORDEGRC() method in the Financial\Amortization class instead
*
* @param float $cost The cost of the asset
* @param mixed $purchased Date of the purchase of the asset
* @param mixed $firstPeriod Date of the end of the first period
* @param mixed $salvage The salvage value at the end of the life of the asset
* @param float $period The period
* @param float $rate Rate of depreciation
* @param int $basis 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
*
* @return float|string (string containing the error type if there is an error)
*/
public static function AMORDEGRC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis = 0)
{
return Amortization::AMORDEGRC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis);
}
/**
* AMORLINC.
*
* Returns the depreciation for each accounting period.
* This function is provided for the French accounting system. If an asset is purchased in
* the middle of the accounting period, the prorated depreciation is taken into account.
*
* Excel Function:
* AMORLINC(cost,purchased,firstPeriod,salvage,period,rate[,basis])
*
* @Deprecated 1.18.0
*
* @see Financial\Amortization::AMORLINC()
* Use the AMORLINC() method in the Financial\Amortization class instead
*
* @param float $cost The cost of the asset
* @param mixed $purchased Date of the purchase of the asset
* @param mixed $firstPeriod Date of the end of the first period
* @param mixed $salvage The salvage value at the end of the life of the asset
* @param float $period The period
* @param float $rate Rate of depreciation
* @param int $basis 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
*
* @return float|string (string containing the error type if there is an error)
*/
public static function AMORLINC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis = 0)
{
return Amortization::AMORLINC($cost, $purchased, $firstPeriod, $salvage, $period, $rate, $basis);
}
/**
* COUPDAYBS.
*
* Returns the number of days from the beginning of the coupon period to the settlement date.
*
* Excel Function:
* COUPDAYBS(settlement,maturity,frequency[,basis])
*
* @Deprecated 1.18.0
*
* @see Financial\Coupons::COUPDAYBS()
* Use the COUPDAYBS() method in the Financial\Coupons class instead
*
* @param mixed $settlement The security's settlement date.
* The security settlement date is the date after the issue
* date when the security is traded to the buyer.
* @param mixed $maturity The security's maturity date.
* The maturity date is the date when the security expires.
* @param int $frequency the number of coupon payments per year.
* Valid frequency values are:
* 1 Annual
* 2 Semi-Annual
* 4 Quarterly
* @param int $basis 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
*
* @return float|string
*/
public static function COUPDAYBS($settlement, $maturity, $frequency, $basis = 0)
{
return Coupons::COUPDAYBS($settlement, $maturity, $frequency, $basis);
}
/**
* COUPDAYS.
*
* Returns the number of days in the coupon period that contains the settlement date.
*
* Excel Function:
* COUPDAYS(settlement,maturity,frequency[,basis])
*
* @Deprecated 1.18.0
*
* @see Financial\Coupons::COUPDAYS()
* Use the COUPDAYS() method in the Financial\Coupons class instead
*
* @param mixed $settlement The security's settlement date.
* The security settlement date is the date after the issue
* date when the security is traded to the buyer.
* @param mixed $maturity The security's maturity date.
* The maturity date is the date when the security expires.
* @param mixed $frequency the number of coupon payments per year.
* Valid frequency values are:
* 1 Annual
* 2 Semi-Annual
* 4 Quarterly
* @param int $basis 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
*
* @return float|string
*/
public static function COUPDAYS($settlement, $maturity, $frequency, $basis = 0)
{
return Coupons::COUPDAYS($settlement, $maturity, $frequency, $basis);
}
/**
* COUPDAYSNC.
*
* Returns the number of days from the settlement date to the next coupon date.
*
* Excel Function:
* COUPDAYSNC(settlement,maturity,frequency[,basis])
*
* @Deprecated 1.18.0
*
* @see Financial\Coupons::COUPDAYSNC()
* Use the COUPDAYSNC() method in the Financial\Coupons class instead
*
* @param mixed $settlement The security's settlement date.
* The security settlement date is the date after the issue
* date when the security is traded to the buyer.
* @param mixed $maturity The security's maturity date.
* The maturity date is the date when the security expires.
* @param mixed $frequency the number of coupon payments per year.
* Valid frequency values are:
* 1 Annual
* 2 Semi-Annual
* 4 Quarterly
* @param int $basis 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
*
* @return float|string
*/
public static function COUPDAYSNC($settlement, $maturity, $frequency, $basis = 0)
{
return Coupons::COUPDAYSNC($settlement, $maturity, $frequency, $basis);
}
/**
* COUPNCD.
*
* Returns the next coupon date after the settlement date.
*
* Excel Function:
* COUPNCD(settlement,maturity,frequency[,basis])
*
* @Deprecated 1.18.0
*
* @see Financial\Coupons::COUPNCD()
* Use the COUPNCD() method in the Financial\Coupons class instead
*
* @param mixed $settlement The security's settlement date.
* The security settlement date is the date after the issue
* date when the security is traded to the buyer.
* @param mixed $maturity The security's maturity date.
* The maturity date is the date when the security expires.
* @param mixed $frequency the number of coupon payments per year.
* Valid frequency values are:
* 1 Annual
* 2 Semi-Annual
* 4 Quarterly
* @param int $basis 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
*
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
*/
public static function COUPNCD($settlement, $maturity, $frequency, $basis = 0)
{
return Coupons::COUPNCD($settlement, $maturity, $frequency, $basis);
}
/**
* COUPNUM.
*
* Returns the number of coupons payable between the settlement date and maturity date,
* rounded up to the nearest whole coupon.
*
* Excel Function:
* COUPNUM(settlement,maturity,frequency[,basis])
*
* @Deprecated 1.18.0
*
* @see Financial\Coupons::COUPNUM()
* Use the COUPNUM() method in the Financial\Coupons class instead
*
* @param mixed $settlement The security's settlement date.
* The security settlement date is the date after the issue
* date when the security is traded to the buyer.
* @param mixed $maturity The security's maturity date.
* The maturity date is the date when the security expires.
* @param mixed $frequency the number of coupon payments per year.
* Valid frequency values are:
* 1 Annual
* 2 Semi-Annual
* 4 Quarterly
* @param int $basis 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
*
* @return int|string
*/
public static function COUPNUM($settlement, $maturity, $frequency, $basis = 0)
{
return Coupons::COUPNUM($settlement, $maturity, $frequency, $basis);
}
/**
* COUPPCD.
*
* Returns the previous coupon date before the settlement date.
*
* Excel Function:
* COUPPCD(settlement,maturity,frequency[,basis])
*
* @Deprecated 1.18.0
*
* @see Financial\Coupons::COUPPCD()
* Use the COUPPCD() method in the Financial\Coupons class instead
*
* @param mixed $settlement The security's settlement date.
* The security settlement date is the date after the issue
* date when the security is traded to the buyer.
* @param mixed $maturity The security's maturity date.
* The maturity date is the date when the security expires.
* @param mixed $frequency the number of coupon payments per year.
* Valid frequency values are:
* 1 Annual
* 2 Semi-Annual
* 4 Quarterly
* @param int $basis 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
*
* @return mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
* depending on the value of the ReturnDateType flag
*/
public static function COUPPCD($settlement, $maturity, $frequency, $basis = 0)
{
return Coupons::COUPPCD($settlement, $maturity, $frequency, $basis);
}
/**
* CUMIPMT.
*
* Returns the cumulative interest paid on a loan between the start and end periods.
*
* Excel Function:
* CUMIPMT(rate,nper,pv,start,end[,type])
*
* @Deprecated 1.18.0
*
* @see Financial\CashFlow\Constant\Periodic\Cumulative::interest()
* Use the interest() method in the Financial\CashFlow\Constant\Periodic\Cumulative class instead
*
* @param float $rate The Interest rate
* @param int $nper The total number of payment periods
* @param float $pv Present Value
* @param int $start The first period in the calculation.
* Payment periods are numbered beginning with 1.
* @param int $end the last period in the calculation
* @param int $type A number 0 or 1 and indicates when payments are due:
* 0 or omitted At the end of the period.
* 1 At the beginning of the period.
*
* @return float|string
*/
public static function CUMIPMT($rate, $nper, $pv, $start, $end, $type = 0)
{
return Financial\CashFlow\Constant\Periodic\Cumulative::interest($rate, $nper, $pv, $start, $end, $type);
}
/**
* CUMPRINC.
*
* Returns the cumulative principal paid on a loan between the start and end periods.
*
* Excel Function:
* CUMPRINC(rate,nper,pv,start,end[,type])
*
* @Deprecated 1.18.0
*
* @see Financial\CashFlow\Constant\Periodic\Cumulative::principal()
* Use the principal() method in the Financial\CashFlow\Constant\Periodic\Cumulative class instead
*
* @param float $rate The Interest rate
* @param int $nper The total number of payment periods
* @param float $pv Present Value
* @param int $start The first period in the calculation.
* Payment periods are numbered beginning with 1.
* @param int $end the last period in the calculation
* @param int $type A number 0 or 1 and indicates when payments are due:
* 0 or omitted At the end of the period.
* 1 At the beginning of the period.
*
* @return float|string
*/
public static function CUMPRINC($rate, $nper, $pv, $start, $end, $type = 0)
{
return Financial\CashFlow\Constant\Periodic\Cumulative::principal($rate, $nper, $pv, $start, $end, $type);
}
/**
* 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.
*
* Excel Function:
* DB(cost,salvage,life,period[,month])
*
* @Deprecated 1.18.0
*
* @see Financial\Depreciation::DB()
* Use the DB() method in the Financial\Depreciation class instead
*
* @param float $cost Initial cost of the asset
* @param float $salvage Value at the end of the depreciation.
* (Sometimes called the salvage value of the asset)
* @param int $life Number of periods over which the asset is depreciated.
* (Sometimes called the useful life of the asset)
* @param int $period The period for which you want to calculate the
* depreciation. Period must use the same units as life.
* @param int $month Number of months in the first year. If month is omitted,
* it defaults to 12.
*
* @return float|string
*/
public static function DB($cost, $salvage, $life, $period, $month = 12)
{
return Depreciation::DB($cost, $salvage, $life, $period, $month);
}
/**
* DDB.
*
* Returns the depreciation of an asset for a specified period using the
* double-declining balance method or some other method you specify.
*
* Excel Function:
* DDB(cost,salvage,life,period[,factor])
*
* @Deprecated 1.18.0
*
* @see Financial\Depreciation::DDB()
* Use the DDB() method in the Financial\Depreciation class instead
*
* @param float $cost Initial cost of the asset
* @param float $salvage Value at the end of the depreciation.
* (Sometimes called the salvage value of the asset)
* @param int $life Number of periods over which the asset is depreciated.
* (Sometimes called the useful life of the asset)
* @param int $period The period for which you want to calculate the
* depreciation. Period must use the same units as life.
* @param float $factor The rate at which the balance declines.
* If factor is omitted, it is assumed to be 2 (the
* double-declining balance method).
*
* @return float|string
*/
public static function DDB($cost, $salvage, $life, $period, $factor = 2.0)
{
return Depreciation::DDB($cost, $salvage, $life, $period, $factor);
}
/**
* DISC.
*
* Returns the discount rate for a security.
*
* Excel Function:
* DISC(settlement,maturity,price,redemption[,basis])
*
* @Deprecated 1.18.0
*
* @see Financial\Securities\Rates::discount()
* Use the discount() method in the Financial\Securities\Rates class instead
*
* @param mixed $settlement The security's settlement date.
* The security settlement date is the date after the issue
* date when the security is traded to the buyer.
* @param mixed $maturity The security's maturity date.
* The maturity date is the date when the security expires.
* @param int $price The security's price per $100 face value
* @param int $redemption The security's redemption value per $100 face value
* @param int $basis 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
*
* @return float|string
*/
public static function DISC($settlement, $maturity, $price, $redemption, $basis = 0)
{
return Financial\Securities\Rates::discount($settlement, $maturity, $price, $redemption, $basis);
}
/**
* 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.
*
* Excel Function:
* DOLLARDE(fractional_dollar,fraction)
*
* @Deprecated 1.18.0
*
* @see Financial\Dollar::decimal()
* Use the decimal() method in the Financial\Dollar class instead
*
* @param float $fractional_dollar Fractional Dollar
* @param int $fraction Fraction
*
* @return float|string
*/
public static function DOLLARDE($fractional_dollar = null, $fraction = 0)
{
return Dollar::decimal($fractional_dollar, $fraction);
}
/**
* 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.
*
* Excel Function:
* DOLLARFR(decimal_dollar,fraction)
*
* @Deprecated 1.18.0
*
* @see Financial\Dollar::fractional()
* Use the fractional() method in the Financial\Dollar class instead
*
* @param float $decimal_dollar Decimal Dollar
* @param int $fraction Fraction
*
* @return float|string
*/
public static function DOLLARFR($decimal_dollar = null, $fraction = 0)
{
return Dollar::fractional($decimal_dollar, $fraction);
}
/**
* EFFECT.
*
* Returns the effective interest rate given the nominal rate and the number of
* compounding payments per year.
*
* Excel Function:
* EFFECT(nominal_rate,npery)
*
* @Deprecated 1.18.0
*
* @see Financial\InterestRate::effective()
* Use the effective() method in the Financial\InterestRate class instead
*
* @param float $nominalRate Nominal interest rate
* @param int $periodsPerYear Number of compounding payments per year
*
* @return float|string
*/
public static function EFFECT($nominalRate = 0, $periodsPerYear = 0)
{
return Financial\InterestRate::effective($nominalRate, $periodsPerYear);
}
/**
* FV.
*
* Returns the Future Value of a cash flow with constant payments and interest rate (annuities).
*
* Excel Function:
* FV(rate,nper,pmt[,pv[,type]])
*
* @Deprecated 1.18.0
*
* @see Financial\CashFlow\Constant\Periodic::futureValue()
* Use the futureValue() method in the Financial\CashFlow\Constant\Periodic class instead
*
* @param float $rate The interest rate per period
* @param int $nper Total number of payment periods in an annuity
* @param float $pmt The payment made each period: it cannot change over the
* life of the annuity. Typically, pmt contains principal
* and interest but no other fees or taxes.
* @param float $pv present Value, or the lump-sum amount that a series of
* future payments is worth right now
* @param int $type A number 0 or 1 and indicates when payments are due:
* 0 or omitted At the end of the period.
* 1 At the beginning of the period.
*
* @return float|string
*/
public static function FV($rate = 0, $nper = 0, $pmt = 0, $pv = 0, $type = 0)
{
return Financial\CashFlow\Constant\Periodic::futureValue($rate, $nper, $pmt, $pv, $type);
}
/**
* FVSCHEDULE.
*
* Returns the future value of an initial principal after applying a series of compound interest rates.
* Use FVSCHEDULE to calculate the future value of an investment with a variable or adjustable rate.
*
* Excel Function:
* FVSCHEDULE(principal,schedule)
*
* @Deprecated 1.18.0
*
* @see Financial\CashFlow\Single::futureValue()
* Use the futureValue() method in the Financial\CashFlow\Single class instead
*
* @param float $principal the present value
* @param float[] $schedule an array of interest rates to apply
*
* @return float|string
*/
public static function FVSCHEDULE($principal, $schedule)
{
return Financial\CashFlow\Single::futureValue($principal, $schedule);
}
/**
* INTRATE.
*
* Returns the interest rate for a fully invested security.
*
* Excel Function:
* INTRATE(settlement,maturity,investment,redemption[,basis])
*
* @Deprecated 1.18.0
*
* @see Financial\Securities\Rates::interest()
* Use the interest() method in the Financial\Securities\Rates class instead
*
* @param mixed $settlement The security's settlement date.
* The security settlement date is the date after the issue date when the security
* is traded to the buyer.
* @param mixed $maturity The security's maturity date.
* The maturity date is the date when the security expires.
* @param int $investment the amount invested in the security
* @param int $redemption the amount to be received at maturity
* @param int $basis 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
*
* @return float|string
*/
public static function INTRATE($settlement, $maturity, $investment, $redemption, $basis = 0)
{
return Financial\Securities\Rates::interest($settlement, $maturity, $investment, $redemption, $basis);
}
/**
* IPMT.
*
* Returns the interest payment for a given period for an investment based on periodic, constant payments
* and a constant interest rate.
*
* Excel Function:
* IPMT(rate,per,nper,pv[,fv][,type])
*
* @Deprecated 1.18.0
*
* @see Financial\CashFlow\Constant\Periodic\Interest::payment()
* Use the payment() method in the Financial\CashFlow\Constant\Periodic class instead
*
* @param float $rate Interest rate per period
* @param int $per Period for which we want to find the interest
* @param int $nper Number of periods
* @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|string
*/
public static function IPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0)
{
return Financial\CashFlow\Constant\Periodic\Interest::payment($rate, $per, $nper, $pv, $fv, $type);
}
/**
* IRR.
*
* Returns the internal rate of return for a series of cash flows represented by the numbers in values.
* These cash flows do not have to be even, as they would be for an annuity. However, the cash flows must occur
* at regular intervals, such as monthly or annually. The internal rate of return is the interest rate received
* for an investment consisting of payments (negative values) and income (positive values) that occur at regular
* periods.
*
* Excel Function:
* IRR(values[,guess])
*
* @Deprecated 1.18.0
*
* @see Financial\CashFlow\Variable\Periodic::rate()
* Use the rate() method in the Financial\CashFlow\Variable\Periodic class instead
*
* @param mixed $values An array or a reference to cells that contain numbers for which you want
* to calculate the internal rate of return.
* Values must contain at least one positive value and one negative value to
* calculate the internal rate of return.
* @param mixed $guess A number that you guess is close to the result of IRR
*
* @return float|string
*/
public static function IRR($values, $guess = 0.1)
{
return Financial\CashFlow\Variable\Periodic::rate($values, $guess);
}
/**
* 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)
*
* @Deprecated 1.18.0
*
* @see Financial\CashFlow\Constant\Periodic\Interest::schedulePayment()
* Use the schedulePayment() method in the Financial\CashFlow\Constant\Periodic class instead
*
* 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
*/
public static function ISPMT(...$args)
{
return Financial\CashFlow\Constant\Periodic\Interest::schedulePayment(...$args);
}
/**
* MIRR.
*
* Returns the modified internal rate of return for a series of periodic cash flows. MIRR considers both
* the cost of the investment and the interest received on reinvestment of cash.
*
* Excel Function:
* MIRR(values,finance_rate, reinvestment_rate)
*
* @Deprecated 1.18.0
*
* @see Financial\CashFlow\Variable\Periodic::modifiedRate()
* Use the modifiedRate() method in the Financial\CashFlow\Variable\Periodic class instead
*
* @param mixed $values An array or a reference to cells that contain a series of payments and
* income occurring at regular intervals.
* Payments are negative value, income is positive values.
* @param mixed $finance_rate The interest rate you pay on the money used in the cash flows
* @param mixed $reinvestment_rate The interest rate you receive on the cash flows as you reinvest them
*
* @return float|string Result, or a string containing an error
*/
public static function MIRR($values, $finance_rate, $reinvestment_rate)
{
return Financial\CashFlow\Variable\Periodic::modifiedRate($values, $finance_rate, $reinvestment_rate);
}
/**
* NOMINAL.
*
* Returns the nominal interest rate given the effective rate and the number of compounding payments per year.
*
* Excel Function:
* NOMINAL(effect_rate, npery)
*
* @Deprecated 1.18.0
*
* @see Financial\InterestRate::nominal()
* Use the nominal() method in the Financial\InterestRate class instead
*
* @param float $effectiveRate Effective interest rate
* @param int $periodsPerYear Number of compounding payments per year
*
* @return float|string Result, or a string containing an error
*/
public static function NOMINAL($effectiveRate = 0, $periodsPerYear = 0)
{
return InterestRate::nominal($effectiveRate, $periodsPerYear);
}
/**
* NPER.
*
* Returns the number of periods for a cash flow with constant periodic payments (annuities), and interest rate.
*
* @Deprecated 1.18.0
*
* @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|string Result, or a string containing an error
*
*@see Financial\CashFlow\Constant\Periodic::periods()
* Use the periods() method in the Financial\CashFlow\Constant\Periodic class instead
*/
public static function NPER($rate = 0, $pmt = 0, $pv = 0, $fv = 0, $type = 0)
{
return Financial\CashFlow\Constant\Periodic::periods($rate, $pmt, $pv, $fv, $type);
}
/**
* NPV.
*
* Returns the Net Present Value of a cash flow series given a discount rate.
*
* @Deprecated 1.18.0
*
* @see Financial\CashFlow\Variable\Periodic::presentValue()
* Use the presentValue() method in the Financial\CashFlow\Variable\Periodic class instead
*
* @return float
*/
public static function NPV(...$args)
{
return Financial\CashFlow\Variable\Periodic::presentValue(...$args);
}
/**
* PDURATION.
*
* Calculates the number of periods required for an investment to reach a specified value.
*
* @Deprecated 1.18.0
*
* @see Financial\CashFlow\Single::periods()
* Use the periods() method in the Financial\CashFlow\Single class instead
*
* @param float $rate Interest rate per period
* @param float $pv Present Value
* @param float $fv Future Value
*
* @return float|string Result, or a string containing an error
*/
public static function PDURATION($rate = 0, $pv = 0, $fv = 0)
{
return Financial\CashFlow\Single::periods($rate, $pv, $fv);
}
/**
* PMT.
*
* Returns the constant payment (annuity) for a cash flow with a constant interest rate.
*
* @Deprecated 1.18.0
*
* @see Financial\CashFlow\Constant\Periodic\Payments::annuity()
* Use the annuity() method in the Financial\CashFlow\Constant\Periodic\Payments class instead
*
* @param float $rate Interest rate per period
* @param int $nper Number of periods
* @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|string Result, or a string containing an error
*/
public static function PMT($rate = 0, $nper = 0, $pv = 0, $fv = 0, $type = 0)
{
return Financial\CashFlow\Constant\Periodic\Payments::annuity($rate, $nper, $pv, $fv, $type);
}
/**
* PPMT.
*
* Returns the interest payment for a given period for an investment based on periodic, constant payments
* and a constant interest rate.
*
* @Deprecated 1.18.0
*
* @see Financial\CashFlow\Constant\Periodic\Payments::interestPayment()
* Use the interestPayment() method in the Financial\CashFlow\Constant\Periodic\Payments class instead
*
* @param float $rate Interest rate per period
* @param int $per Period for which we want to find the interest
* @param int $nper Number of periods
* @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|string Result, or a string containing an error
*/
public static function PPMT($rate, $per, $nper, $pv, $fv = 0, $type = 0)
{
return Financial\CashFlow\Constant\Periodic\Payments::interestPayment($rate, $per, $nper, $pv, $fv, $type);
}
/**
* PRICE.
*
* Returns the price per $100 face value of a security that pays periodic interest.
*
* @Deprecated 1.18.0
*
* @see Financial\Securities\Price::price()
* Use the price() method in the Financial\Securities\Price class instead
*
* @param mixed $settlement The security's settlement date.
* The security settlement date is the date after the issue date when the security
* is traded to the buyer.
* @param mixed $maturity The security's maturity date.
* The maturity date is the date when the security expires.
* @param float $rate the security's annual coupon rate
* @param float $yield the security's annual yield
* @param float $redemption The number of coupon payments per year.
* For annual payments, frequency = 1;
* for semiannual, frequency = 2;
* for quarterly, frequency = 4.
* @param int $frequency
* @param int $basis 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
*
* @return float|string Result, or a string containing an error
*/
public static function PRICE($settlement, $maturity, $rate, $yield, $redemption, $frequency, $basis = 0)
{
return Securities\Price::price($settlement, $maturity, $rate, $yield, $redemption, $frequency, $basis);
}
/**
* PRICEDISC.
*
* Returns the price per $100 face value of a discounted security.
*
* @Deprecated 1.18.0
*
* @see Financial\Securities\Price::priceDiscounted()
* Use the priceDiscounted() method in the Financial\Securities\Price class instead
*
* @param mixed $settlement The security's settlement date.
* The security settlement date is the date after the issue date when the security
* is traded to the buyer.
* @param mixed $maturity The security's maturity date.
* The maturity date is the date when the security expires.
* @param int $discount The security's discount rate
* @param int $redemption The security's redemption value per $100 face value
* @param int $basis 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
*
* @return float|string Result, or a string containing an error
*/
public static function PRICEDISC($settlement, $maturity, $discount, $redemption, $basis = 0)
{
return Securities\Price::priceDiscounted($settlement, $maturity, $discount, $redemption, $basis);
}
/**
* PRICEMAT.
*
* Returns the price per $100 face value of a security that pays interest at maturity.
*
* @Deprecated 1.18.0
*
* @see Financial\Securities\Price::priceAtMaturity()
* Use the priceAtMaturity() method in the Financial\Securities\Price class instead
*
* @param mixed $settlement 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.
* @param mixed $maturity The security's maturity date.
* The maturity date is the date when the security expires.
* @param mixed $issue The security's issue date
* @param int $rate The security's interest rate at date of issue
* @param int $yield The security's annual yield
* @param int $basis 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
*
* @return float|string Result, or a string containing an error
*/
public static function PRICEMAT($settlement, $maturity, $issue, $rate, $yield, $basis = 0)
{
return Securities\Price::priceAtMaturity($settlement, $maturity, $issue, $rate, $yield, $basis);
}
/**
* PV.
*
* Returns the Present Value of a cash flow with constant payments and interest rate (annuities).
*
* @Deprecated 1.18.0
*
* @see Financial\CashFlow\Constant\Periodic::presentValue()
* Use the presentValue() method in the Financial\CashFlow\Constant\Periodic class instead
*
* @param float $rate Interest rate per period
* @param int $nper Number of periods
* @param float $pmt Periodic payment (annuity)
* @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|string Result, or a string containing an error
*/
public static function PV($rate = 0, $nper = 0, $pmt = 0, $fv = 0, $type = 0)
{
return Financial\CashFlow\Constant\Periodic::presentValue($rate, $nper, $pmt, $fv, $type);
}
/**
* RATE.
*
* Returns the interest rate per period of an annuity.
* RATE is calculated by iteration and can have zero or more solutions.
* If the successive results of RATE do not converge to within 0.0000001 after 20 iterations,
* RATE returns the #NUM! error value.
*
* Excel Function:
* RATE(nper,pmt,pv[,fv[,type[,guess]]])
*
* @Deprecated 1.18.0
*
* @see Financial\CashFlow\Constant\Periodic\Interest::rate()
* Use the rate() method in the Financial\CashFlow\Constant\Periodic class instead
*
* @param mixed $nper The total number of payment periods in an annuity
* @param mixed $pmt The payment made each period and cannot change over the life
* of the annuity.
* Typically, pmt includes principal and interest but no other
* fees or taxes.
* @param mixed $pv The present value - the total amount that a series of future
* payments is worth now
* @param mixed $fv The future value, or a cash balance you want to attain after
* the last payment is made. If fv is omitted, it is assumed
* to be 0 (the future value of a loan, for example, is 0).
* @param mixed $type A number 0 or 1 and indicates when payments are due:
* 0 or omitted At the end of the period.
* 1 At the beginning of the period.
* @param mixed $guess Your guess for what the rate will be.
* If you omit guess, it is assumed to be 10 percent.
*
* @return float|string
*/
public static function RATE($nper, $pmt, $pv, $fv = 0.0, $type = 0, $guess = 0.1)
{
return Financial\CashFlow\Constant\Periodic\Interest::rate($nper, $pmt, $pv, $fv, $type, $guess);
}
/**
* RECEIVED.
*
* Returns the amount received at maturity for a fully invested Security.
*
* @Deprecated 1.18.0
*
* @see Financial\Securities\Price::received()
* Use the received() method in the Financial\Securities\Price class instead
*
* @param mixed $settlement The security's settlement date.
* The security settlement date is the date after the issue date when the security
* is traded to the buyer.
* @param mixed $maturity The security's maturity date.
* The maturity date is the date when the security expires.
* @param mixed $investment The amount invested in the security
* @param mixed $discount The security's discount rate
* @param mixed $basis 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
*
* @return float|string Result, or a string containing an error
*/
public static function RECEIVED($settlement, $maturity, $investment, $discount, $basis = 0)
{
return Financial\Securities\Price::received($settlement, $maturity, $investment, $discount, $basis);
}
/**
* RRI.
*
* Calculates the interest rate required for an investment to grow to a specified future value .
*
* @Deprecated 1.18.0
*
* @see Financial\CashFlow\Single::interestRate()
* Use the interestRate() method in the Financial\CashFlow\Single class instead
*
* @param float $nper The number of periods over which the investment is made
* @param float $pv Present Value
* @param float $fv Future Value
*
* @return float|string Result, or a string containing an error
*/
public static function RRI($nper = 0, $pv = 0, $fv = 0)
{
return Financial\CashFlow\Single::interestRate($nper, $pv, $fv);
}
/**
* SLN.
*
* Returns the straight-line depreciation of an asset for one period
*
* @Deprecated 1.18.0
*
* @see Financial\Depreciation::SLN()
* Use the SLN() method in the Financial\Depreciation class instead
*
* @param mixed $cost Initial cost of the asset
* @param mixed $salvage Value at the end of the depreciation
* @param mixed $life Number of periods over which the asset is depreciated
*
* @return float|string Result, or a string containing an error
*/
public static function SLN($cost, $salvage, $life)
{
return Depreciation::SLN($cost, $salvage, $life);
}
/**
* SYD.
*
* Returns the sum-of-years' digits depreciation of an asset for a specified period.
*
* @Deprecated 1.18.0
*
* @see Financial\Depreciation::SYD()
* Use the SYD() method in the Financial\Depreciation class instead
*
* @param mixed $cost Initial cost of the asset
* @param mixed $salvage Value at the end of the depreciation
* @param mixed $life Number of periods over which the asset is depreciated
* @param mixed $period Period
*
* @return float|string Result, or a string containing an error
*/
public static function SYD($cost, $salvage, $life, $period)
{
return Depreciation::SYD($cost, $salvage, $life, $period);
}
/**
* TBILLEQ.
*
* Returns the bond-equivalent yield for a Treasury bill.
*
* @Deprecated 1.18.0
*
* @see Financial\TreasuryBill::bondEquivalentYield()
* Use the bondEquivalentYield() method in the Financial\TreasuryBill class instead
*
* @param mixed $settlement 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.
* @param mixed $maturity The Treasury bill's maturity date.
* The maturity date is the date when the Treasury bill expires.
* @param int $discount The Treasury bill's discount rate
*
* @return float|string Result, or a string containing an error
*/
public static function TBILLEQ($settlement, $maturity, $discount)
{
return TreasuryBill::bondEquivalentYield($settlement, $maturity, $discount);
}
/**
* TBILLPRICE.
*
* Returns the price per $100 face value for a Treasury bill.
*
* @Deprecated 1.18.0
*
* @see Financial\TreasuryBill::price()
* Use the price() method in the Financial\TreasuryBill class instead
*
* @param mixed $settlement 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.
* @param mixed $maturity The Treasury bill's maturity date.
* The maturity date is the date when the Treasury bill expires.
* @param int $discount The Treasury bill's discount rate
*
* @return float|string Result, or a string containing an error
*/
public static function TBILLPRICE($settlement, $maturity, $discount)
{
return TreasuryBill::price($settlement, $maturity, $discount);
}
/**
* TBILLYIELD.
*
* Returns the yield for a Treasury bill.
*
* @Deprecated 1.18.0
*
* @see Financial\TreasuryBill::yield()
* Use the yield() method in the Financial\TreasuryBill class instead
*
* @param mixed $settlement 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.
* @param mixed $maturity The Treasury bill's maturity date.
* The maturity date is the date when the Treasury bill expires.
* @param int $price The Treasury bill's price per $100 face value
*
* @return float|mixed|string
*/
public static function TBILLYIELD($settlement, $maturity, $price)
{
return TreasuryBill::yield($settlement, $maturity, $price);
}
/**
* XIRR.
*
* Returns the internal rate of return for a schedule of cash flows that is not necessarily periodic.
*
* Excel Function:
* =XIRR(values,dates,guess)
*
* @Deprecated 1.18.0
*
* @see Financial\CashFlow\Variable\NonPeriodic::rate()
* Use the rate() method in the Financial\CashFlow\Variable\NonPeriodic class instead
*
* @param float[] $values A series of cash flow payments
* The series of values must contain at least one positive value & one negative value
* @param mixed[] $dates A series of payment dates
* The first payment date indicates the beginning of the schedule of payments
* All other dates must be later than this date, but they may occur in any order
* @param float $guess An optional guess at the expected answer
*
* @return float|mixed|string
*/
public static function XIRR($values, $dates, $guess = 0.1)
{
return Financial\CashFlow\Variable\NonPeriodic::rate($values, $dates, $guess);
}
/**
* 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)
*
* @Deprecated 1.18.0
*
* @see Financial\CashFlow\Variable\NonPeriodic::presentValue()
* Use the presentValue() method in the Financial\CashFlow\Variable\NonPeriodic class instead
*
* @param float $rate the discount rate to apply to the cash flows
* @param 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.
* @param 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.
*
* @return float|mixed|string
*/
public static function XNPV($rate, $values, $dates)
{
return Financial\CashFlow\Variable\NonPeriodic::presentValue($rate, $values, $dates);
}
/**
* YIELDDISC.
*
* Returns the annual yield of a security that pays interest at maturity.
*
* @Deprecated 1.18.0
*
* @see Financial\Securities\Yields::yieldDiscounted()
* Use the yieldDiscounted() method in the Financial\Securities\Yields class instead
*
* @param mixed $settlement 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.
* @param mixed $maturity The security's maturity date.
* The maturity date is the date when the security expires.
* @param int $price The security's price per $100 face value
* @param int $redemption The security's redemption value per $100 face value
* @param int $basis 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
*
* @return float|string Result, or a string containing an error
*/
public static function YIELDDISC($settlement, $maturity, $price, $redemption, $basis = 0)
{
return Securities\Yields::yieldDiscounted($settlement, $maturity, $price, $redemption, $basis);
}
/**
* YIELDMAT.
*
* Returns the annual yield of a security that pays interest at maturity.
*
* @Deprecated 1.18.0
*
* @see Financial\Securities\Yields::yieldAtMaturity()
* Use the yieldAtMaturity() method in the Financial\Securities\Yields class instead
*
* @param mixed $settlement 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.
* @param mixed $maturity The security's maturity date.
* The maturity date is the date when the security expires.
* @param mixed $issue The security's issue date
* @param int $rate The security's interest rate at date of issue
* @param int $price The security's price per $100 face value
* @param int $basis 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
*
* @return float|string Result, or a string containing an error
*/
public static function YIELDMAT($settlement, $maturity, $issue, $rate, $price, $basis = 0)
{
return Securities\Yields::yieldAtMaturity($settlement, $maturity, $issue, $rate, $price, $basis);
}
}