IAM
Updated 2024-02-23 16:59:43.167000
Syntax
SELECT [westclintech].[wct].[IAM](
<@A, float,>
,<@B, float,>
,<@D_IM, float,>
,<@DSM, float,>
,<@R, float,>
,<@P, float,>
,<@Y, float,>)
Description
Use the scalar function IAM to calculate the price or yield for a bond that pays interest at maturity and has a par value of 100. The formula for price is:
\mathrm{P=\left[\frac{100+(\frac{DIM}{B}\times{R}\times{100})}{1+\left(\frac{DSM}{B}\times{Y}\right)}\right]-\left[\frac{A}{B}\times{R}\times{100}\right]}
Where:
{"columns":[{"field":"column 1"},{"field":"column 2"},{"field":"column 3"}],"rows":[{"column 1":"A","column 2":"=","column 3":"Number of days from issue date to settlement date"},{"column 1":"B","column 2":"=","column 3":"Number of days in the year"},{"column 1":"DIM","column 2":"=","column 3":"Number of days from issue date to maturity date"},{"column 1":"DSM","column 2":"=","column 3":"Number of days from settlement date to maturity date"},{"column 1":"P","column 2":"=","column 3":"Price per 100 par value"},{"column 1":"R","column 2":"=","column 3":"Annual interest rate in decimal terms"},{"column 1":"Y","column 2":"=","column 3":"Annual Yield"}]}
The formula for yield is:
\mathrm{Y=\left[\frac{\left(1+\left(\frac{DIM}{B}\times{R}\right)\right)\times\left(\frac{P}{100}+\frac{A}{B}\times{R}\right)}{\frac{P}{100}+\left(\frac{A}{B}\times{R}\right)}\right]\times\frac{B}{DSM}}
Where:
{"columns":[{"field":"column 1"},{"field":"column 2"},{"field":"column 3"}],"rows":[{"column 1":"A","column 2":"=","column 3":"Number of days from issue date to settlement date"},{"column 1":"B","column 2":"=","column 3":"Number of days in the year"},{"column 1":"DIM","column 2":"=","column 3":"Number of days from issue date to maturity date"},{"column 1":"DSM","column 2":"=","column 3":"Number of days from settlement date to maturity date"},{"column 1":"P","column 2":"=","column 3":"Price per 100 par value"},{"column 1":"R","column 2":"=","column 3":"Annual interest rate in decimal terms"},{"column 1":"Y","column 2":"=","column 3":"Annual Yield"}]}
The IAM function allows you to pass values for A, B, DIM, DSM and R directly into the function and automatically calculates Y or P.
Arguments
@A
the number of days from issue to settlement. @A is an expression of type float or of a type that can be implicitly converted to float.
@P
the price of the security. @P is an expression of type float or of a type that can be implicitly converted to float.
@R
the annual interest rate. @R is an expression of type float or of a type that can be implicitly converted to float.
@B
the number days in the year. @DSC is an expression of type float or of a type that can be implicitly converted to float.
@D_IM
the number of days from issue to maturity. @D_IM is an expression of type float or of a type that can be implicitly converted to float.
@DSM
the number of days from settlement to maturity. @DSM is an expression of type float or of a type that can be implicitly converted to float.
@Y
the yield on the security. @Y is an expression of type float or of a type that can be implicitly converted to float.
Return Type
float
Remarks
If @A is NULL then @A = @D_IM - @DSM.
If @B is NULL then @B = 360.
If @D_IM is NULL then @D_IM = 0.
If @DSM is NULL then @DSM = 0.
If @R is NULL then @R = 0.
If @Y is NULL and @P is NULL then NULL is returned.
If @Y is not NULL then the function calculates the price from the inputs otherwise the function calculates the yield.
Examples
In this example we calculate the price for a security with an interest rate of 0.5%. There are 68 accrued days, 137 days from issue to maturity, 69 days from settlement to maturity, and 365 days in the year. The yield is 0.2%
SELECT wct.IAM( 68, --@A
365, --@B
137, --@D_IM
69, --@DSM
0.005, --@R
NULL, --@P
0.002 --@Y
) as Price;
This produce the following result.
{"columns":[{"field":"Price","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"Price":"100.056655689645"}]}
In this example we calculate the yield for a security with an interest rate -0.05%. There are 108 days from issue to maturity, 55 days from settlement to maturity, and 360 days in the year. The price is 99.977088.
SELECT wct.IAM( NULL, --@A
360, --@B
108, --@D_IM
55, --@DSM
-0.0005, --@R
99.977088, --@P
NULL --@Y
) as Yield;
This produces the following result.
{"columns":[{"field":"Yield","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"Yield":"0.000999997275740647"}]}
In this example we calculate the price for a security with an interest rate of 0.2%. The yield is -0.05%. There are 95 days from issue to maturity, 38 days from settlement to maturity, and 360 days in the year.
SELECT wct.IAM( NULL, --@A
360, --@B
95, --@D_IM
38, --@DSM
0.002, --@R
NULL, --@P
-0.0005 --@Y
) as Price;
This produces the following result.
{"columns":[{"field":"Price","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"Price":"100.026391953094"}]}
In this example we calculate the yield for a security with an interest rate 0.07%. There are 181 days from issue to maturity, 83 days from settlement to maturity, and 364 days in the year. The price is 99.628637 .
SELECT wct.IAM( NULL, --@A
364, --@B
181, --@D_IM
83, --@DSM
0.07, --@R
99.628637, --@P
NULL --@Y
) as Yield;
This produces the following result.
{"columns":[{"field":"Yield","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"Yield":"0.0850000161919074"}]}
See Also
IAMFACTORS - Factors for the price calculation of a security paying interest at maturity
PRICEMAT - Price of an interest-at-maturity security
RPI - Calculate the price and/or yield of a bond with regular periodic coupons
YIELDMAT - Calculate the YIELD of an Interest-at-Maturity Security