Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

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