Logo

MDURATION

Updated 2023-10-06 14:28:25.967000

Syntax

SELECT [westclintech].[wct].[MDURATION] (
  <@Settlement, datetime,>
 ,<@Maturity, datetime,>
 ,<@Coupon, float,>
 ,<@Yld, float,>
 ,<@Frequency, float,>
 ,<@Basis, nvarchar(4000),>)

Description

Use the scalar function MDURATION to calculate the modified duration for a security with an assumed par value of 100.

Arguments

@Coupon

the security’s annual coupon rate. @Coupon is an expression of type float or of a type that can be implicitly converted to float.

@Yld

the security’s annual yield. @Yld is an expression of type float or of a type that can be implicitly converted to float.

@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.

@Basis

{"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"}]}

@Settlement

the settlement date 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 security. @Maturity is an expression that returns a datetime or smalldatetime value, or a character string in date format.

Return Type

float

Remarks

If @Yld < 0 or if @Coupon < 0, MDURATION returns an error.

If the @Frequency is any number other than 1, 2, 4 or 12, MDURATION returns an error.

If @Settlement > @Maturity, MDURATION returns an error.

If the @Basis < 0 or the @Basis > 4, MDURATION returns an error.

Examples

SELECT wct.MDURATION('12/22/2007', '12/15/2009', 0.05, 0.06, 2, 0);

Here is the result set

----------------------
      1.85222452413439