Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

(no description)

File Size: 415 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Coupons:: (9 methods):
  COUPDAYBS()
  COUPDAYS()
  COUPDAYSNC()
  COUPNCD()
  COUPNUM()
  COUPPCD()
  monthsDiff()
  couponFirstPeriodDate()
  validateCouponPeriod()


Class: Coupons  - X-Ref

COUPDAYBS($settlement,$maturity,$frequency,$basis = FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)   X-Ref
COUPDAYBS.

Returns the number of days from the beginning of the coupon period to the settlement date.

Excel Function:
COUPDAYBS(settlement,maturity,frequency[,basis])

return: float|string
param: mixed $settlement The security's settlement date.
param: mixed $maturity The security's maturity date.
param: mixed $frequency The number of coupon payments per year (int).
param: mixed $basis The type of day count to use (int).

COUPDAYS($settlement,$maturity,$frequency,$basis = FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)   X-Ref
COUPDAYS.

Returns the number of days in the coupon period that contains the settlement date.

Excel Function:
COUPDAYS(settlement,maturity,frequency[,basis])

return: float|string
param: mixed $settlement The security's settlement date.
param: mixed $maturity The security's maturity date.
param: mixed $frequency The number of coupon payments per year.
param: mixed $basis The type of day count to use (int).

COUPDAYSNC($settlement,$maturity,$frequency,$basis = FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)   X-Ref
COUPDAYSNC.

Returns the number of days from the settlement date to the next coupon date.

Excel Function:
COUPDAYSNC(settlement,maturity,frequency[,basis])

return: float|string
param: mixed $settlement The security's settlement date.
param: mixed $maturity The security's maturity date.
param: mixed $frequency The number of coupon payments per year.
param: mixed $basis The type of day count to use (int) .

COUPNCD($settlement,$maturity,$frequency,$basis = FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)   X-Ref
COUPNCD.

Returns the next coupon date after the settlement date.

Excel Function:
COUPNCD(settlement,maturity,frequency[,basis])

return: mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
param: mixed $settlement The security's settlement date.
param: mixed $maturity The security's maturity date.
param: mixed $frequency The number of coupon payments per year.
param: mixed $basis The type of day count to use (int).

COUPNUM($settlement,$maturity,$frequency,$basis = FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)   X-Ref
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])

return: int|string
param: mixed $settlement The security's settlement date.
param: mixed $maturity The security's maturity date.
param: mixed $frequency The number of coupon payments per year.
param: mixed $basis The type of day count to use (int).

COUPPCD($settlement,$maturity,$frequency,$basis = FinancialConstants::BASIS_DAYS_PER_YEAR_NASD)   X-Ref
COUPPCD.

Returns the previous coupon date before the settlement date.

Excel Function:
COUPPCD(settlement,maturity,frequency[,basis])

return: mixed Excel date/time serial value, PHP date/time serial value or PHP date/time object,
param: mixed $settlement The security's settlement date.
param: mixed $maturity The security's maturity date.
param: mixed $frequency The number of coupon payments per year.
param: mixed $basis The type of day count to use (int).

monthsDiff(DateTime $result, int $months, string $plusOrMinus, int $day, bool $lastDayFlag)   X-Ref
No description

couponFirstPeriodDate(float $settlement, float $maturity, int $frequency, bool $next)   X-Ref
No description

validateCouponPeriod(float $settlement, float $maturity)   X-Ref
No description