COUPNUM
Updated 2023-10-06 13:54:32.977000
Syntax
SELECT [westclintech].[wct].[COUPNUM] (
<@Settlement, datetime,>
,<@Maturity, datetime,>
,<@Frequency, float,>
,<@Basis, nvarchar(4000),>)
Description
Use the scalar function COUPNUM to calculate the number of coupons payable between the settlement date and maturity date rounded up to the nearest whole coupon.
Arguments
@Settlement
the settlement date occurring within the coupon period of the security. @Settlement is an expression that returns a datetime or smalldatetime value, or a character string in date format.
@Maturity
The maturity date of the instrument. @Maturity is an expression that returns a datetime or smalldatetime value, or a character string in date format.
@Basis
Is the type of day count to use. @Basis is an expression of the character string data type category.
{"columns":[{"field":"Basis","width":139},{"field":"Day count basis","width":174}],"rows":[{"Basis":"0 or omitted","Day count basis":"US (NASD) 30/360"},{"Basis":"1","Day count basis":"Actual/Actual"},{"Basis":"2","Day count basis":"Actual/360"},{"Basis":"3","Day count basis":"Actual/365"},{"Basis":"4","Day count basis":"European 30/360"}]}
@Frequency
The number of coupon payments per year. For annual payments, @Frequency = 1; for semi-annual, @Frequency = 2; for quarterly, @Frequency = 4; for monthly, @Frequency = 12. @Frequency is an expression of type float or of a type that can be implicitly converted to float.
Return Type
int
Remarks
A settlement date occurs in the coupon period where the settlement date is greater than or equal to start date of the coupon period and less than the end date of the coupon period (as the end date of one period is the start date of the next period).
If the @Frequency is any number other than 1, 2, 4 or 12, COUPNUM returns an error.
If @Basis < 0 or @Basis > 4, COUPNUM returns an error.
If @Settlement > @Maturity, COUPNUM returns an error.
Examples
SELECT wct.COUPNUM('12/16/2007', '3/1/2027', 2, 1);
Here is the result set
{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"39"}]}
See Also
COUPDAYBS - Number of days from previous coupon to settlement date
COUPDAYS - Number of days in a coupon period
COUPDAYSNC - Number of days from settlement to next coupon date
COUPPCD - Calculate the immediately previous coupon date before the settlement date.