Logo

SQL Server INTRATE Function

Updated 2023-10-06 14:27:15.823000

Description

Use the scalar function INTRATE to calculate the interest rate for a fully invested security.

Syntax

SELECT [westclintech].[wct].[INTRATE] (
  <@Settlement, datetime,>
 ,<@Maturity, datetime,>
 ,<@Investment, float,>
 ,<@Redemption, float,>
 ,<@Basis, nvarchar(4000),>)

Arguments

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

@Investment

the amount invested in the security. @Investment is an expression of type float or of a type that can be implicitly converted to float.

@Redemption

the security's redemption value per 100 face value. @Redemption is an expression of type float or of a type that can be implicitly converted to float.

@Basis

is the type of day count to use. @Basis is an expression of the character string data type category.

@BasisDay count basis
0 or omittedUS (NASD) 30/360
1Actual/Actual
2Actual/360
3Actual/365
4European 30/360

Return Type

float

Remarks

If @Redemption < 0, INTRATE returns an error.

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

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

INTRATE is calculated using the following formula:

    INTRATE = (@redemption-@investment)/@investment*b/DSM

Where

    b = the number of days in the year

    DSM = the number of days between @settlement and @maturity

Examples

SELECT wct.INTRATE('2/7/2008', '5/8/2008', 98975, 100000, 0);

Here is the result set.

column 1
0.0409693867637793