Login     Register

        Contact Us     Search

XLeratorDB/financial Documentation

SQL Server disambiguation function for odd-last coupon bonds


OLCFACTORS

Updated: 30 June 2014


Use the table-valued function OLCFACTORS to return the components used in the calculation of price and yield for a bond with an odd last coupon. OLCFACTORS supports odd last coupon bonds with up to 2 quasi-coupon periods.
Syntax
SELECT * FROM [wctFinancial].[wct].[OLCFACTORS](
  <@Settlement, datetime,>
 ,<@Maturity, datetime,>
 ,<@LastCoupon, datetime,>
 ,<@Rate, float,>
 ,<@Price, float,>
 ,<@Yield, float,>
 ,<@Redemption, float,>
 ,<@Frequency, 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. 
@LastCoupon
the last coupon date of the security. The period from the last coupon date until the maturity date defines the odd interest period. All previous coupon dates are assumed to occur at regular periodic intervals as defined by @Frequency. @Lastcoupon is an expression that returns a datetime or smalldatetime value, or a character string in date format. 
@Rate
the security’s annual coupon rate. @Rate is an expression of type float or of a type that can be implicitly converted to float.
@Price
the price of the bond. @Price is an expression of type float or of a type that can be implicitly converted to float.
@Yield
the security’s annual yield. @Yld 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.
@Frequency
the number of coupon payments per year. For annual payments, @Frequency = 1; for semi-annual, @Frequency = 2; for quarterly, @Frequency = 4; for bimonthly @Frequency = 6; for monthly @Frequency = 12. For bonds with @Basis = 'A/364' or 9, you can enter 364 for payments made every 52 weeks, 182 for payments made every 26 weeks, 91 for payments made every 13 weeks, 28 for payments made every 4 weeks, 14 for payments made every 2 weeks, and 7 for weekly payments. @Frequency 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.
 
@Basis
Day count basis
0, 'BOND'
US (NASD) 30/360
1, 'ACTUAL'
Actual/Actual
2, 'A360'
Actual/360
3, 'A365'
Actual/365
4, '30E/360 (ISDA)', '30E/360', 'ISDA', '30E/360 ISDA', 'EBOND'
European 30/360
5, '30/360', '30/360 ISDA', 'GERMAN'
30/360 ISDA
6, 'NL/ACT'
No Leap Year/ACT
7, 'NL/365'
No Leap Year /365
8, 'NL/360'
No Leap Year /360
9, 'A/364'
Actual/364
10, 'BOND NON-EOM'
US (NASD) 30/360 non-end-of-month
11, 'ACTUAL NON-EOM'
Actual/Actual non-end-of-month
12, 'A360 NON-EOM'
Actual/360 non-end-of-month
13, 'A365 NON-EOM'
Actual/365 non-end-of-month
14, '30E/360 NON-EOM', '30E/360 ICMA NON-EOM', 'EBOND NON-EOM'
European 30/360 non-end-of-month
15, '30/360 NON-EOM', '30/360 ISDA NON-EOM', 'GERMAN NON-EOM'
30/360 ISDA non-end-of-month
16, 'NL/ACT NON-EOM'
No Leap Year/ACT non-end-of-month
17, 'NL/365 NON-EOM'
No Leap Year/365 non-end-of-month
18, 'NL/360 NON-EOM'
No Leap Year/360 non-end-of-month
19, 'A/364 NON-EOM'
Actual/364 non-end-of-month
 
Return Type
RETURNS TABLE (
      [A] [float] NULL,
      [DSC] [float] NULL,
      [E] [float] NULL,
      [N] [int] NULL,
      [NCL] [int] NULL,
      [A1] [float] NULL,
      [DSC1] [float] NULL,
      [DLC1] [float] NULL,
      [NLL1] [float] NULL,
      [A2] [float] NULL,
      [DSC2] [float] NULL,
      [DLC2] [float] NULL,
      [NLL2] [float] NULL,
      [quasicoup] [datetime] NULL,
      [quasimaturity] [datetime] NULL,
      [C] [float] NULL,
      [LC] [float] NULL,
      [P] [float] NULL,
      [AI] [float] NULL,
      [Y] [float] NULL
)

Column
Description
A
Number of accrued days from the previous coupon date to the settlement date when the settlement date is less than the last coupon date.
DSC
Number of days from the settlement date to the next coupon date when the settlement date is less than the last coupon date.
E
Number of coupon days in the coupon period in which the settlement date falls when the settlement date is less than the last coupon date.
N
Number of coupons between the settlement date and the last coupon date. If the settlement date is greater than the last coupon date then N = 0.
NCL
Number of quasi-coupon periods in the odd period (1 or 2).
A1
If N > 0 then NULL, else the number of accrued days in the first quasi-coupon period. If the settlement date is in the first quasi-coupon period then this the number of days from the last coupon date to the settlement date. If the settlement date is in the second coupon period then this is equal to NLL1
DLC1
Number of days in the first coupon period. If NCL is equal to 1 then this is the number of days from the last coupon date to the maturity date. If NCL = 2 then this is the number of days from the last coupon date to quasicoup.
DSC1
If N > 0 then NULL, else the number of days from the settlement date to the next quasi-coupon or maturity date. If NCL = 1, the number of days from the settlement date to the maturity date. If NCL = 2 and settlement is in the first quasi-coupon period then the number of days from settlement date to quasicoup, else 0.
NLL1
Normal length of the first quasi-coupon period.
A2
Number of days from the quasi-coupon date to the settlement date. If the quasi-coupon date is NULL then A2 is NULL. If settlement date is less than or equal to the quasi-coupon date then A2 = 0
DLC2
Number of days from quasicoup to maturity date. If quasicoup is NULL then NULL.
DSC2
Number of days from the greater of quasicoup and settlement date to the maturity date. If quasicoup is NULL then NULL.
NLL2
Normal length of the period from the quasicoup to quasimaturity.
quasimaturity
Implied maturity date with respect to the last coupon date.
quasicoup
Implied next coupon date with respect to the last coupon date when NCL = 2.
C
Coupon amount
LC
Last coupon amount
P
Price. If @Yield is NOT NULL then P is calculated from the inputs otherwise P is the value entered in @Price.
AI
Accrued interest as of the settlement date.
Y
Yield. If @Yield is NOT NULL then Y is the value entered in @Yield otherwise Y is calculated from the inputs.

 
Remarks
·         If @Settlement is NULL then @Settlement = GETDATE().
·         If @Rate is NULL then @Rate = 0.
·         If @Redemption is NULL then @Redemption = 100.
·         If @Frequency is NULL then @Frequency = 2.
·         If @Basis is NULL then @Basis = 0.
·         If @Frequency is any number other than 1, 2, 4, 6 or 12, or for @Basis = 'A/364' any number other than 1, 2, 4, 6, or 12 as well as 7, 14, 28, 91, 182, or 364 OLCFACTORS returns an error.
·         If @Basis is invalid (see above list), OLCFACTORS returns an error.
·         If @Maturity is NULL then an error is returned.
·         If @Issue is NULL then an error is returned.
·         If @LastCoupon is NULL then an error is returned.
·         If there is only one quasi-coupon period then quasicoup is NULL. Otherwise the next coupon date is calculated using @Frequency, @Basis, and @Maturity.
·         If there are 2 quasi-coupon periods then DLC1 = NLL1.
Examples
This is a bond with odd short last coupon periods where the settlement date is in the last coupon period.
SELECT
   *
FROM
   wct.OLCFACTORS(
      '2014-10-01',     --@Settlement
      '2014-12-15',     --@Maturity
      '2014-09-15',     --@Last_interest
      0.0225,           --@Rate
      NULL,             --@Price
      0.0010,           --@Yield
      100,              --@Redemption
      2,                --@Frequency
      1                 --@Basis
      )
This produces the following result (which has been reformatted for ease of viewing).

A
DSC
E
N
NCL
A1
DSC1
DLC1
NLL1
A2
DSC2
DLC2
NLL2
NULL
NULL
NULL
0
1
16
75
91
181
NULL
NULL
NULL
NULL

 

quasicoup
quasimaturity
C
LC
P
AI
Y
NULL
3/15/2015
1.125
0.565607735
100.4453291
0.099447514
0.001



This is a bond with an odd long last coupon period with a settlement date in the last coupon period.
SELECT
   *
FROM
   wct.OLCFACTORS(
      '2014-10-01',     --@Settlement
      '2014-12-15',     --@Maturity
      '2014-03-15',     --@Last_interest
      0.0225,           --@Rate
      NULL,             --@Price
      0.0010,           --@Yield
      100,              --@Redemption
      2,                --@Frequency
      1                 --@Basis
      )
This produces the following result (which has been reformatted for ease of viewing).

A
DSC
E
N
NCL
A1
DSC1
DLC1
NLL1
A2
DSC2
DLC2
NLL2
NULL
NULL
NULL
0
2
184
0
184
184
16
75
91
181

 

quasicoup
quasimaturity
C
LC
P
AI
Y
9/15/2014
3/15/2015
1.125
1.690607735
100.4450961
1.224447514
0.001



This is a bond with an odd short last coupon with a settlement date prior to the last coupon date.
SELECT
   *
FROM
   wct.OLCFACTORS(
      '2014-10-01',     --@Settlement
      '2034-12-15',     --@Maturity
      '2034-03-15',     --@Last_interest
      0.0425,           --@Rate
      NULL,             --@Price
      0.0400,           --@Yield
      100,              --@Redemption
      2,                --@Frequency
      1                 --@Basis
      )
This produces the following result.

A
DSC
E
N
NCL
A1
DSC1
DLC1
NLL1
A2
DSC2
DLC2
NLL2
16
165
181
39
2
NULL
NULL
184
184
NULL
NULL
91
181

 

quasicoup
quasimaturity
C
LC
P
AI
Y
9/15/2034
3/15/2035
2.125
3.193370166
103.4336872
0.187845304
0.04

 


This is a bond with odd long last coupon period with a settlement date prior to the last coupon date.
 
SELECT
   *
FROM
   wct.OLCFACTORS(
      '2014-10-01',     --@Settlement
      '2034-12-15',     --@Maturity
      '2034-03-15',     --@Last_interest
      0.0425,           --@Rate
      103.4336872,      --@Price
      NULL,             --@Yield
      100,              --@Redemption
      2,                --@Frequency
      1                 --@Basis
      )
This produces the following result.

A
DSC
E
N
NCL
A1
DSC1
DLC1
NLL1
A2
DSC2
DLC2
NLL2
16
165
181
39
2
NULL
NULL
184
184
NULL
NULL
91
181

 

quasicoup
quasimaturity
C
LC
P
AI
Y
9/15/2034
3/15/2035
2.125
3.193370166
103.4336872
0.187845304
0.04

 
This is an example of a bond paying interest every 26 weeks.
SELECT
   *
FROM
   wct.OLCFACTORS(
      '2014-10-04', --@Settlement
      '2014-12-15', --@Maturity
      '2014-06-01', --@Last_interest
      0.1250,        --@Rate
      NULL,          --@Price
      0.1100,        --@Yield
      100,           --@Redemption
      182,           --@Frequency
      9              --@Basis
   )
This produces the following result.

A
DSC
E
N
NCL
A1
DSC1
DLC1
NLL1
A2
DSC2
DLC2
NLL2
NULL
NULL
NULL
0
2
125
57
182
182
0
15
15
182

 

quasicoup
quasimaturity
C
LC
P
AI
Y
2014-11-30
2015-05-31
6.25
6.76510989
100.1989749
4.292582418
0.11

 

See Also

 



Copyright 2008-2024 Westclintech LLC         Privacy Policy        Terms of Service