Logo

OFCFACTORS

Updated 2023-10-06 20:43:53.430000

Syntax

SELECT * FROM [westclintech].[wct].[OFCFACTORS](
  <@Settlement, datetime,>
 ,<@Maturity, datetime,>
 ,<@Issue, datetime,>
 ,<@FirstCoupon, datetime,>
 ,<@Rate, float,>
 ,<@Price, float,>
 ,<@Yield, float,>
 ,<@Redemption, float,>
 ,<@Frequency, float,>
 ,<@Basis, nvarchar(4000),>)

Description

Use the table-valued function OFCFACTORS to return the components used in the calculation of price and yield for a bond with an odd first coupon. OFCFACTORS supports odd first coupon bonds with up to 2 quasi-coupon periods.

Arguments

@FirstCoupon

the first coupon date of the security. The period from the issue date until the first coupon date defines the odd interest period. All subsequent coupon dates are assumed to occur at regular periodic intervals as defined by @Frequency. @First_coupon 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":313},{"field":"Day count basis","width":277}],"rows":[{"@Basis":"0 , 'BOND'","Day count basis":"US (NASD) 30/360"},{"@Basis":"1 , 'ACTUAL'","Day count basis":"Actual/Actual"},{"@Basis":"2 , 'A360'","Day count basis":"Actual/360"},{"@Basis":"3 , 'A365'","Day count basis":"Actual/365"},{"@Basis":"4 , '30E/360 (ISDA)' , '30E/360' , 'ISDA' , '30E/360 ISDA' , 'EBOND'","Day count basis":"European 30/360"},{"@Basis":"5 , '30/360' , '30/360 ISDA' , 'GERMAN'","Day count basis":"30/360 ISDA"},{"@Basis":"6 , 'NL/ACT'","Day count basis":"No Leap Year/ACT"},{"@Basis":"7 , 'NL/365'","Day count basis":"No Leap Year /365"},{"@Basis":"8 , 'NL/360'","Day count basis":"No Leap Year /360"},{"@Basis":"9 , 'A/364'","Day count basis":"Actual/364"},{"@Basis":"10 , 'BOND NON-EOM'","Day count basis":"US (NASD) 30/360 non-end-of-month"},{"@Basis":"11 , 'ACTUAL NON-EOM'","Day count basis":"Actual/Actual non-end-of-month"},{"@Basis":"12 , 'A360 NON-EOM'","Day count basis":"Actual/360 non-end-of-month"},{"@Basis":"13 , 'A365 NON-EOM'","Day count basis":"Actual/365 non-end-of-month"},{"@Basis":"14 , '30E/360 NON-EOM' , '30E/360 ICMA NON-EOM' , 'EBOND NON-EOM'","Day count basis":"European 30/360 non-end-of-month"},{"@Basis":"15 , '30/360 NON-EOM' , '30/360 ISDA NON-EOM' , 'GERMAN NON-EOM'","Day count basis":"30/360 ISDA non-end-of-month"},{"@Basis":"16 , 'NL/ACT NON-EOM'","Day count basis":"No Leap Year/ACT non-end-of-month"},{"@Basis":"17 , 'NL/365 NON-EOM'","Day count basis":"No Leap Year/365 non-end-of-month"},{"@Basis":"18 , 'NL/360 NON-EOM'","Day count basis":"No Leap Year/360 non-end-of-month"},{"@Basis":"19 , 'A/364 NON-EOM'","Day count basis":"Actual/364 non-end-of-month"}]}

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

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

@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. ### @Issue the issue date of the security; the date from which the security starts accruing interest. @Issue is an expression that returns a datetime or smalldatetime value, or a character string in date format.

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

@Price

the price of the bond. @Price is an expression of type float or of a type that can be implicitly converted to float.

Return Type

table

{"columns": [{"field": "colName", "headerName": "Name", "header": "name"}, {"field": "colDatatype", "headerName": "Type", "header": "type"}, {"field": "colDesc", "headerName": "Description", "header": "description", "minWidth": 1000}], "rows": [{"id": "8f85c190-54ac-4c5c-8ab7-1ecc41de76a9", "colName": "E", "colDatatype": "float", "colDesc": "Number of coupon days in the quasi-coupon period in which the settlement date falls."}, {"id": "86f8f1d9-9cb5-45f5-b9d2-bb1b219b8dcc", "colName": "DSC", "colDatatype": "float", "colDesc": "Number of days from the settlement date to the next quasi-coupon date."}, {"id": "190ca9f2-8acd-4011-9ba3-00100180ae4e", "colName": "N", "colDatatype": "int", "colDesc": "\t Number of coupons between the first coupon date and the maturity date."}, {"id": "70b0609b-1ec8-4b56-afdc-367a129918ec", "colName": "NCF", "colDatatype": "int", "colDesc": "\t Number of quasi-coupon periods in the odd period (1 or 2)."}, {"id": "64814a45-ac26-4efe-8f8e-5a98eed17865", "colName": "A1", "colDatatype": "float", "colDesc": "Number of accrued days in the first quasi-coupon period."}, {"id": "809327fb-5f60-4f52-a383-bc8d7866d6ce", "colName": "DFC1", "colDatatype": "float", "colDesc": "\t Number of accrued days from the issue date to the next quasi-coupon date."}, {"id": "9c5fe908-26b9-46cc-87c1-cbb8c59a2a76", "colName": "NLF1", "colDatatype": "float", "colDesc": "Normal length of the first quasi-coupon period."}, {"id": "2139714e-a279-4f0f-99c5-5b8e8f2540fc", "colName": "A2", "colDatatype": "float", "colDesc": "\t Number of accrued days in the second quasi-coupon period."}, {"id": "05a4c916-9e3b-43b7-9ff3-4937285d6df7", "colName": "DFC2", "colDatatype": "float", "colDesc": "Number of accrued days from the quasicoup date to to the first coupon date."}, {"id": "89e649ce-0d6b-41af-8a26-70d3e8338758", "colName": "NLF2", "colDatatype": "float", "colDesc": "Normal length of the period from the quasicoup date to the first coupon date."}, {"id": "0df5496a-e40a-483d-9b84-e48f74021f41", "colName": "Nqf", "colDatatype": "float", "colDesc": "\t Number of whole coupons between the settlement date and the first coupon date."}, {"id": "86a4577c-45d8-4153-8999-cb35c3dfa497", "colName": "quasistart", "colDatatype": "datetime", "colDesc": "Implied previous coupon date with respect to the issue date."}, {"id": "e5b977fb-6379-47f0-9123-a728017d5495", "colName": "quasicoup", "colDatatype": "datetime", "colDesc": "Implied next coupon date with respect to the issue date when NCF = 2."}, {"id": "160c8cf0-32a6-416a-9c28-fd855e7752dc", "colName": "C", "colDatatype": "float", "colDesc": "Coupon amount"}, {"id": "ff0e4810-a212-4deb-bd16-15477cb7cd3b", "colName": "FC", "colDatatype": "float", "colDesc": "First coupon amount"}, {"id": "a5f760ca-490e-49b3-ab9d-614d15ce5820", "colName": "P", "colDatatype": "float", "colDesc": "Price. If @Yield is NOT NULL then P is calculated from the inputs otherwise P is the value entered in @Price."}, {"id": "17c0fd41-c1a8-45b7-93f8-58723c23bd09", "colName": "AI", "colDatatype": "float", "colDesc": "\t Accrued interest as of the settlement date."}, {"id": "7c3554c0-40e3-4eff-90fa-39794157ebe2", "colName": "Y", "colDatatype": "float", "colDesc": "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 OFCFACTORS returns an error.

If @Basis invalid (see above list), OFCFACTORS returns an error.

If @Maturity is NULL then an error is returned.

If @Issue is NULL then an error is returned.

If @FirstCoupon is NULL then an error is returned.

If @Settlement >= @FirstCoupon then nothing is returned.

The first quasi-coupon period is always the quasi-coupon period in which the issue date occurs.

The previous coupon date for the first quasi-coupon period is calculated using @Frequency, @Basis, and @Maturity. This is the value returned in quasistart.

If there is only one quasi-coupon period then quasicoup is NULL. Otherwise the previous coupon date for the second quasi-coupon period is calculated using @Frequency, @Basis, and @Maturity.

If there are 2 quasi-coupon periods then DFC2 = NLF2.

Examples

This bond has an odd short first coupon (meaning that the first coupon period is shorter than a normal coupon period) and settles on the issue date.

SELECT *

FROM wct.OFCFACTORS(   '2014-05-01', --@Settlement

                       '2034-06-15', --@Maturity

                       '2014-05-01', --@Issue

                       '2014-06-15', --@FirstCoupon

                       0.025,        --@Rate

                       NULL,         --@Price

                       0.0276,       --@Yield

                       100,          --@Redemption

                       2,            --@Frequency

                       1             --@Basis

                   );

This produces the following result.

{"columns":[{"field":"E","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"DSC","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"NCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"A1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"DFC1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"NLF1"},{"field":"A2"},{"field":"DFC2"},{"field":"NLF2"},{"field":"Nqf","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"quasistart","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"quasicoup"},{"field":"C","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"FC","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"P","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"AI","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"Y","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"E":"182","DSC":"45","N":"40","NCF":"1","A1":"0","DFC1":"45","NLF1":"NULL","A2":"NULL","DFC2":"NULL","NLF2":"NULL","Nqf":"0","quasistart":"2013-12-15 00:00:00.000","quasicoup":"NULL","C":"1.25","FC":"0.309065934065934","P":"96.0075631077824","AI":"0","Y":"0.0276"}]}

This bond has odd long first coupon (meaning that the first coupon period is longer than a normal coupon period) and settles on the issue date.

SELECT *

FROM wct.OFCFACTORS(   '2014-05-01', --@Settlement

                       '2034-06-15', --@Maturity

                       '2014-05-01', --@Issue

                       '2014-12-15', --@FirstCoupon

                       0.025,        --@Rate

                       NULL,         --@Price

                       0.0276,       --@Yield

                       100,          --@Redemption

                       2,            --@Frequency

                       1             --@Basis

                   );

This produces the following result.

{"columns":[{"field":"E","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"DSC","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"NCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"A1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"DFC1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"NLF1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"A2","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"DFC2","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"NLF2","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"Nqf","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"quasistart","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"quasicoup","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"C","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"FC","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"P","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"AI","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"Y","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"E":"182","DSC":"45","N":"39","NCF":"2","A1":"0","DFC1":"45","NLF1":"182","A2":"0","DFC2":"183","NLF2":"183","Nqf":"1","quasistart":"2013-12-15 00:00:00.000","quasicoup":"2014-06-15 00:00:00.000","C":"1.25","FC":"1.55906593406593","P":"96.0033702877755","AI":"0","Y":"0.0276"}]}

Here we calculate the factors for a bond with an odd long first coupon with semi-annual coupons payable on March 30th and September 30th.

SELECT *

FROM wct.OFCFACTORS(   '2014-09-15', --@Settlement

                       '2034-09-30', --@Maturity

                       '2014-03-01', --@Issue

                       '2014-09-30', --@FirstCoupon

                       0.0257,       --@Rate

                       98.116208,    --@Price

                       NULL,         --@Yield

                       100,          --@Redemption

                       2,            --@Frequency

                       11            --@Basis

                   );

This produces the following result.

{"columns":[{"field":"E","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"DSC","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"NCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"A1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"DFC1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"NLF1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"A2","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"DFC2","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"NLF2","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"Nqf","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"quasistart","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"quasicoup","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"C","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"FC","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"P","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"AI","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"Y","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"E":"184","DSC":"15","N":"40","NCF":"2","A1":"29","DFC1":"29","NLF1":"181","A2":"169","DFC2":"184","NLF2":"184","Nqf":"0","quasistart":"2013-09-30 00:00:00.000","quasicoup":"2014-03-30 00:00:00.000","C":"1.285","FC":"1.49088397790055","P":"98.116208","AI":"1.38612854311794","Y":"0.0269218470830028"}]}

Here's an example with a negative yield.

SELECT *

FROM wct.OFCFACTORS(   '2014-03-15', --@Settlement

                       '2024-09-30', --@Maturity

                       '2014-03-01', --@Issue

                       '2014-03-30', --@FirstCoupon

                       0.0157,       --@Rate

                       NULL,         --@Price

                       -0.00235,     --@Yield

                       100,          --@Redemption

                       2,            --@Frequency

                       10            --@Basis

                   );

This produces the following result.

{"columns":[{"field":"E","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"DSC","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"NCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"A1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"DFC1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"NLF1"},{"field":"A2"},{"field":"DFC2"},{"field":"NLF2"},{"field":"Nqf","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"quasistart","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"quasicoup"},{"field":"C","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"FC","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"P","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"AI","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"Y","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"E":"180","DSC":"15","N":"21","NCF":"1","A1":"14","DFC1":"29","NLF1":"NULL","A2":"NULL","DFC2":"NULL","NLF2":"NULL","Nqf":"0","quasistart":"2013-09-30 00:00:00.000","quasicoup":"NULL","C":"0.785","FC":"0.126472222222222","P":"119.276791530979","AI":"0.0610555555555555","Y":"-0.00235"}]}

This is an example of a bond paying interest every 26 weeks.

SELECT *

FROM wct.OFCFACTORS(   '2014-10-04', --@Settlement

                       '2029-12-12', --@Maturity

                       '2014-03-26', --@Issue

                       '2014-12-31', --@FirstCoupon

                       0.1250,       --@Rate

                       NULL,         --@Price

                       0.1100,       --@Yield

                       100,          --@Redemption

                       182,          --@Frequency

                       9             --@Basis

                   );

This produces the following result.

{"columns":[{"field":"E","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"DSC","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"NCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"A1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"DFC1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"NLF1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"A2","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"DFC2","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"NLF2","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"Nqf","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"quasistart","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"quasicoup","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"C","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"FC","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"P","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"AI","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"Y","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"E":"182","DSC":"88","N":"30","NCF":"2","A1":"98","DFC1":"98","NLF1":"182","A2":"94","DFC2":"182","NLF2":"182","Nqf":"0","quasistart":"2014-01-01 00:00:00.000","quasicoup":"2014-07-02 00:00:00.000","C":"6.25","FC":"9.61538461538462","P":"110.842432897841","AI":"6.59340659340659","Y":"0.11"}]}

See Also

ODDFINT - Accrued interest for a bond with an odd first coupon

ODDFPRICE - Price of a security with an odd first coupon

ODDFYIELD - Calculate the YIELD with an odd first period

OFC - Calculate the price and/or yield of a bond with an odd first coupon using the ODDFPRICE equation

OFCCONVEXITY - Convexity of a bond with and odd first coupon

OFCDURATION - Duration of a bond with an odd first coupon

OFCMDURATION - Modified duration of a bond with an odd first coupon

RPIFACTORS - Factors for the calculation of the price of a bond that pays regular periodic interest