Logo

BONDCF

Updated 2023-10-06 13:39:08.400000

Syntax

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

Description

Use the table-valued function BONDCF to return the cash flows of a bond with regular periodic coupon payments. BONDCF also supports odd first and odd last coupon bonds with up to 2 quasi-coupon periods each.

The first row in the resultant table is dated with settlement date passed into the function and is for the amount of the accrued interest. All the remaining rows are dated for the subsequent coupon dates and the amounts are the coupon amount. The row for the maturity date includes the coupon amount and the redemption amount.

The resultant table also includes the discount factor for each period as will as the discounted cash flow value for each period. The sum of the discounted cash flow values across all the periods is equal to the clean price of the bond.

Arguments

@FirstCoupon

the first coupon date of the bond. 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. @FirstCoupon 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":305},{"field":"Day count basis","width":270}],"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/365'","Day count basis":"Actual/365"},{"@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/365 NON-EOM'","Day count basis":"Actual/365 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 bi-monthly, @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 bond’s annual coupon rate. @Rate is an expression of type float or of a type that can be implicitly converted to float.

@Yield

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

@Issue

the first coupon date of the bond. 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. @FirstCoupon is an expression that returns a datetime or smalldatetime value, or a character string in date format.

@Settlement

the settlement date of the bond. @Settlement is an expression that returns a datetime or smalldatetime value, or a character string in date format.

@Maturity

the maturity date of the bond. @Maturity is an expression that returns a datetime or smalldatetime value, or a character string in date format.

@Redemption

the bond’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.

@LastCoupon

the last coupon date of the bond prior to the maturity. The period from the last interest date until the maturity date defines the odd interest period. All coupon dates from @FirstCoupon to @LastCoupon 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.

Return Type

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 = 1.

If @Maturity <= @Settlement then no rows are returned.

If @Frequency invalid BONDCF returns an error.

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

If @Maturity is NULL then no rows are returned.

To calculate the cash flows for a bond paying regular periodic interest just enter @Maturity and @Settlement.

To calculate the cash flows for bond with an odd first coupon where the settlement date is before the first coupon date, enter @Issue, @FirstCoupon, @Settlement, and @Maturity. If the settlement date is on or after the first coupon date just enter @Maturity and @Settlement.

To calculate the cash flows for bond with an odd first coupon and an odd last coupon where the settlement date is before the first coupon date, enter @Issue, @FirstCoupon, @LastCoupon, @Settlement, and @Maturity. If the settlement date is on or after the first coupon date just enter @LastCoupon, @Maturity and @Settlement.

To calculate the cash flows for a bond with an odd last coupon enter @LastCoupon, @Settlement, and @Maturity.

Examples

In this example we generate the cash flows for bond which pays regular period interest and is maturing on 2034-06-15. The settlement date is 2014-05-01, the yield is 2.76%, the coupon rate is 2.50%, the redemption value is 100, the coupon is paid twice-yearly and the day-count convention is actual/actual.

SELECT *

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

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

                   0.025,        --@Rate

                   0.0276,       --@Yield

                   100,          --@Redemption

                   2,            --@Frequency

                   1,            --@Basis

                   NULL,         --@Issue

                   NULL,         --@FirstCoupon

                   NULL          --@LastCoupon

               );

This produces the following result.

{"columns":[{"field":"date_pmt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt_cashflow","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cumPVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_pmt":"2014-05-01","amt_cashflow":"-0.940934065934066","N":"0","PVF":"1","PVCF":"-0.940934065934066","cumPVCF":"-0.940934065934066"},{"date_pmt":"2014-06-15","amt_cashflow":"1.25","N":"0.247252747252747","PVF":"0.996616976475482","PVCF":"1.24577122059435","cumPVCF":"0.304837154660287"},{"date_pmt":"2014-12-15","amt_cashflow":"1.25","N":"1.24725274725275","PVF":"0.983050874408643","PVCF":"1.2288135930108","cumPVCF":"1.53365074767109"},{"date_pmt":"2015-06-15","amt_cashflow":"1.25","N":"2.24725274725275","PVF":"0.969669436189231","PVCF":"1.21208679523654","cumPVCF":"2.74573754290763"},{"date_pmt":"2015-12-15","amt_cashflow":"1.25","N":"3.24725274725275","PVF":"0.956470148144833","PVCF":"1.19558768518104","cumPVCF":"3.94132522808867"},{"date_pmt":"2016-06-15","amt_cashflow":"1.25","N":"4.24725274725275","PVF":"0.943450530819523","PVCF":"1.1793131635244","cumPVCF":"5.12063839161307"},{"date_pmt":"2016-12-15","amt_cashflow":"1.25","N":"5.24725274725275","PVF":"0.930608138508111","PVCF":"1.16326017313514","cumPVCF":"6.28389856474821"},{"date_pmt":"2017-06-15","amt_cashflow":"1.25","N":"6.24725274725275","PVF":"0.917940558796717","PVCF":"1.1474256984959","cumPVCF":"7.43132426324411"},{"date_pmt":"2017-12-15","amt_cashflow":"1.25","N":"7.24725274725275","PVF":"0.905445412109604","PVCF":"1.131806765137","cumPVCF":"8.56313102838111"},{"date_pmt":"2018-06-15","amt_cashflow":"1.25","N":"8.24725274725275","PVF":"0.893120351262186","PVCF":"1.11640043907773","cumPVCF":"9.67953146745885"},{"date_pmt":"2018-12-15","amt_cashflow":"1.25","N":"9.24725274725275","PVF":"0.880963061020108","PVCF":"1.10120382627514","cumPVCF":"10.780735293734"},{"date_pmt":"2019-06-15","amt_cashflow":"1.25","N":"10.2472527472527","PVF":"0.86897125766434","PVCF":"1.08621407208043","cumPVCF":"11.8669493658144"},{"date_pmt":"2019-12-15","amt_cashflow":"1.25","N":"11.2472527472527","PVF":"0.857142688562182","PVCF":"1.07142836070273","cumPVCF":"12.9383777265171"},{"date_pmt":"2020-06-15","amt_cashflow":"1.25","N":"12.2472527472527","PVF":"0.845475131744113","PVCF":"1.05684391468014","cumPVCF":"13.9952216411973"},{"date_pmt":"2020-12-15","amt_cashflow":"1.25","N":"13.2472527472527","PVF":"0.833966395486401","PVCF":"1.042457994358","cumPVCF":"15.0376796355553"},{"date_pmt":"2021-06-15","amt_cashflow":"1.25","N":"14.2472527472527","PVF":"0.822614317899389","PVCF":"1.02826789737424","cumPVCF":"16.0659475329295"},{"date_pmt":"2021-12-15","amt_cashflow":"1.25","N":"15.2472527472527","PVF":"0.811416766521394","PVCF":"1.01427095815174","cumPVCF":"17.0802184910813"},{"date_pmt":"2022-06-15","amt_cashflow":"1.25","N":"16.2472527472527","PVF":"0.800371637918124","PVCF":"1.00046454739766","cumPVCF":"18.0806830384789"},{"date_pmt":"2022-12-15","amt_cashflow":"1.25","N":"17.2472527472527","PVF":"0.789476857287556","PVCF":"0.986846071609445","cumPVCF":"19.0675291100884"},{"date_pmt":"2023-06-15","amt_cashflow":"1.25","N":"18.2472527472527","PVF":"0.778730378070187","PVCF":"0.973412972587734","cumPVCF":"20.0409420826761"},{"date_pmt":"2023-12-15","amt_cashflow":"1.25","N":"19.2472527472527","PVF":"0.768130181564596","PVCF":"0.960162726955745","cumPVCF":"21.0011048096318"},{"date_pmt":"2024-06-15","amt_cashflow":"1.25","N":"20.2472527472527","PVF":"0.75767427654823","PVCF":"0.947092845685288","cumPVCF":"21.9481976553171"},{"date_pmt":"2024-12-15","amt_cashflow":"1.25","N":"21.2472527472527","PVF":"0.747360698903364","PVCF":"0.934200873629205","cumPVCF":"22.8823985289463"},{"date_pmt":"2025-06-15","amt_cashflow":"1.25","N":"22.2472527472527","PVF":"0.737187511248139","PVCF":"0.921484389060174","cumPVCF":"23.8038829180065"},{"date_pmt":"2025-12-15","amt_cashflow":"1.25","N":"23.2472527472527","PVF":"0.727152802572637","PVCF":"0.908941003215796","cumPVCF":"24.7128239212223"},{"date_pmt":"2026-06-15","amt_cashflow":"1.25","N":"24.2472527472527","PVF":"0.717254687879894","PVCF":"0.896568359849868","cumPVCF":"25.6093922810722"},{"date_pmt":"2026-12-15","amt_cashflow":"1.25","N":"25.2472527472527","PVF":"0.707491307831815","PVCF":"0.884364134789769","cumPVCF":"26.4937564158619"},{"date_pmt":"2027-06-15","amt_cashflow":"1.25","N":"26.2472527472527","PVF":"0.697860828399897","PVCF":"0.872326035499871","cumPVCF":"27.3660824513618"},{"date_pmt":"2027-12-15","amt_cashflow":"1.25","N":"27.2472527472527","PVF":"0.688361440520711","PVCF":"0.860451800650889","cumPVCF":"28.2265342520127"},{"date_pmt":"2028-06-15","amt_cashflow":"1.25","N":"28.2472527472527","PVF":"0.678991359756077","PVCF":"0.848739199695096","cumPVCF":"29.0752734517078"},{"date_pmt":"2028-12-15","amt_cashflow":"1.25","N":"29.2472527472527","PVF":"0.669748825957859","PVCF":"0.837186032447323","cumPVCF":"29.9124594841551"},{"date_pmt":"2029-06-15","amt_cashflow":"1.25","N":"30.2472527472527","PVF":"0.660632102937323","PVCF":"0.825790128671654","cumPVCF":"30.7382496128268"},{"date_pmt":"2029-12-15","amt_cashflow":"1.25","N":"31.2472527472527","PVF":"0.651639478139005","PVCF":"0.814549347673756","cumPVCF":"31.5527989605005"},{"date_pmt":"2030-06-15","amt_cashflow":"1.25","N":"32.2472527472527","PVF":"0.642769262319003","PVCF":"0.803461577898754","cumPVCF":"32.3562605383993"},{"date_pmt":"2030-12-15","amt_cashflow":"1.25","N":"33.2472527472527","PVF":"0.634019789227661","PVCF":"0.792524736534576","cumPVCF":"33.1487852749339"},{"date_pmt":"2031-06-15","amt_cashflow":"1.25","N":"34.2472527472527","PVF":"0.625389415296568","PVCF":"0.781736769120711","cumPVCF":"33.9305220440546"},{"date_pmt":"2031-12-15","amt_cashflow":"1.25","N":"35.2472527472527","PVF":"0.616876519329817","PVCF":"0.771095649162271","cumPVCF":"34.7016176932168"},{"date_pmt":"2032-06-15","amt_cashflow":"1.25","N":"36.2472527472527","PVF":"0.608479502199464","PVCF":"0.76059937774933","cumPVCF":"35.4622170709662"},{"date_pmt":"2032-12-15","amt_cashflow":"1.25","N":"37.2472527472527","PVF":"0.600196786545141","PVCF":"0.750245983181427","cumPVCF":"36.2124630541476"},{"date_pmt":"2033-06-15","amt_cashflow":"1.25","N":"38.2472527472527","PVF":"0.592026816477748","PVCF":"0.740033520597185","cumPVCF":"36.9524965747448"},{"date_pmt":"2033-12-15","amt_cashflow":"1.25","N":"39.2472527472527","PVF":"0.583968057287185","PVCF":"0.729960071608981","cumPVCF":"37.6824566463538"},{"date_pmt":"2034-06-15","amt_cashflow":"101.25","N":"40.2472527472527","PVF":"0.576018995154059","PVCF":"58.3219232593485","cumPVCF":"96.0043799057023"}]}

In this example we generate the cash flows for a zero-coupon bond.

SELECT *

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

                   '2044-06-15', --@Maturity

                   0.0000,       --@Rate

                   0.0301,       --@Yield

                   100,          --@Redemption

                   2,            --@Frequency

                   1,            --@Basis

                   NULL,         --@Issue

                   NULL,         --@FirstCoupon

                   NULL          --@LastCoupon

               )

WHERE amt_cashflow != 0;

This produces the following result.

{"columns":[{"field":"date_pmt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt_cashflow","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cumPVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_pmt":"2044-06-15","amt_cashflow":"100","N":"60.2472527472527","PVF":"0.40658357611314","PVCF":"40.658357611314","cumPVCF":"40.658357611314"}]}

In this example we generate the cash flow of a bond paying regular periodic interest settling in the final coupon period.

SELECT *

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

                   '2014-07-15', --@Maturity

                   0.0190,       --@Rate

                   0.0005,       --@Yield

                   100,          --@Redemption

                   2,            --@Frequency

                   0,            --@Basis

                   NULL,         --@Issue

                   NULL,         --@FirstCoupon

                   NULL          --@LastCoupon

               );

This produces the following result.

{"columns":[{"field":"date_pmt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt_cashflow","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cumPVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_pmt":"2014-05-01","amt_cashflow":"-0.559444444444444","N":"0","PVF":"1","PVCF":"-0.559444444444444","cumPVCF":"-0.559444444444444"},{"date_pmt":"2014-07-15","amt_cashflow":"100.95","N":"0.411111111111111","PVF":"0.999897232784408","PVCF":"100.939625649586","cumPVCF":"100.380181205142"}]}

Here we generate the cash flows for a bond paying regular periodic interest which matures on the 30th of September 2034, with semi-annual coupons payable on March 30th and September 30th.

SELECT *

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

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

                   0.0257,       --@Rate

                   0.0269,       --@Yield

                   100,          --@Redemption

                   2,            --@Frequency

                   11,           --@Basis

                   NULL,         --@Issue

                   NULL,         --@FirstCoupon

                   NULL          --@LastCoupon

               );

This produces the following result.

{"columns":[{"field":"date_pmt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt_cashflow","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cumPVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_pmt":"2014-05-01","amt_cashflow":"-0.223478260869565","N":"0","PVF":"1","PVCF":"-0.223478260869565","cumPVCF":"-0.223478260869565"},{"date_pmt":"2014-09-30","amt_cashflow":"1.285","N":"0.826086956521739","PVF":"0.989023869886121","PVCF":"1.27089567280367","cumPVCF":"1.0474174119341"},{"date_pmt":"2015-03-30","amt_cashflow":"1.285","N":"1.82608695652174","PVF":"0.975898041231556","PVCF":"1.25402898298255","cumPVCF":"2.30144639491665"},{"date_pmt":"2015-09-30","amt_cashflow":"1.285","N":"2.82608695652174","PVF":"0.962946411990287","PVCF":"1.23738613940752","cumPVCF":"3.53883253432417"},{"date_pmt":"2016-03-30","amt_cashflow":"1.285","N":"3.82608695652174","PVF":"0.950166670275087","PVCF":"1.22096417130349","cumPVCF":"4.75979670562766"},{"date_pmt":"2016-09-30","amt_cashflow":"1.285","N":"4.82608695652174","PVF":"0.937556534880938","PVCF":"1.20476014732201","cumPVCF":"5.96455685294966"},{"date_pmt":"2017-03-30","amt_cashflow":"1.285","N":"5.82608695652174","PVF":"0.925113754877832","PVCF":"1.18877117501801","cumPVCF":"7.15332802796767"},{"date_pmt":"2017-09-30","amt_cashflow":"1.285","N":"6.82608695652174","PVF":"0.912836109208971","PVCF":"1.17299440033353","cumPVCF":"8.3263224283012"},{"date_pmt":"2018-03-30","amt_cashflow":"1.285","N":"7.82608695652174","PVF":"0.900721406294312","PVCF":"1.15742700708819","cumPVCF":"9.48374943538939"},{"date_pmt":"2018-09-30","amt_cashflow":"1.285","N":"8.82608695652174","PVF":"0.888767483639363","PVCF":"1.14206621647658","cumPVCF":"10.625815651866"},{"date_pmt":"2019-03-30","amt_cashflow":"1.285","N":"9.82608695652174","PVF":"0.876972207449172","PVCF":"1.12690928657219","cumPVCF":"11.7527249384382"},{"date_pmt":"2019-09-30","amt_cashflow":"1.285","N":"10.8260869565217","PVF":"0.865333472247444","PVCF":"1.11195351183797","cumPVCF":"12.8646784502761"},{"date_pmt":"2020-03-30","amt_cashflow":"1.285","N":"11.8260869565217","PVF":"0.853849200500709","PVCF":"1.09719622264341","cumPVCF":"13.9618746729195"},{"date_pmt":"2020-09-30","amt_cashflow":"1.285","N":"12.8260869565217","PVF":"0.84251734224748","PVCF":"1.08263478478801","cumPVCF":"15.0445094577076"},{"date_pmt":"2021-03-30","amt_cashflow":"1.285","N":"13.8260869565217","PVF":"0.831335874732331","PVCF":"1.06826659903104","cumPVCF":"16.1127760567386"},{"date_pmt":"2021-09-30","amt_cashflow":"1.285","N":"14.8260869565217","PVF":"0.820302802044828","PVCF":"1.0540891006276","cumPVCF":"17.1668651573662"},{"date_pmt":"2022-03-30","amt_cashflow":"1.285","N":"15.8260869565217","PVF":"0.809416154763262","PVCF":"1.04009975887079","cumPVCF":"18.206964916237"},{"date_pmt":"2022-09-30","amt_cashflow":"1.285","N":"16.8260869565217","PVF":"0.7986739896031","PVCF":"1.02629607663998","cumPVCF":"19.233260992877"},{"date_pmt":"2023-03-30","amt_cashflow":"1.285","N":"17.8260869565217","PVF":"0.788074389070107","PVCF":"1.01267558995509","cumPVCF":"20.2459365828321"},{"date_pmt":"2023-09-30","amt_cashflow":"1.285","N":"18.8260869565217","PVF":"0.777615461118069","PVCF":"0.999235867536719","cumPVCF":"21.2451724503688"},{"date_pmt":"2024-03-30","amt_cashflow":"1.285","N":"19.8260869565217","PVF":"0.76729533881106","PVCF":"0.985974510372213","cumPVCF":"22.231146960741"},{"date_pmt":"2024-09-30","amt_cashflow":"1.285","N":"20.8260869565217","PVF":"0.757112179990192","PVCF":"0.972889151287397","cumPVCF":"23.2040361120284"},{"date_pmt":"2025-03-30","amt_cashflow":"1.285","N":"21.8260869565217","PVF":"0.747064166944785","PVCF":"0.959977454524049","cumPVCF":"24.1640135665524"},{"date_pmt":"2025-09-30","amt_cashflow":"1.285","N":"22.8260869565217","PVF":"0.737149506087903","PVCF":"0.947237115322955","cumPVCF":"25.1112506818754"},{"date_pmt":"2026-03-30","amt_cashflow":"1.285","N":"23.8260869565217","PVF":"0.727366427636196","PVCF":"0.934665859512512","cumPVCF":"26.0459165413879"},{"date_pmt":"2026-09-30","amt_cashflow":"1.285","N":"24.8260869565217","PVF":"0.717713185293992","PVCF":"0.922261443102779","cumPVCF":"26.9681779844907"},{"date_pmt":"2027-03-30","amt_cashflow":"1.285","N":"25.8260869565217","PVF":"0.708188055941578","PVCF":"0.910021651884927","cumPVCF":"27.8781996363756"},{"date_pmt":"2027-09-30","amt_cashflow":"1.285","N":"26.8260869565217","PVF":"0.698789339327621","PVCF":"0.897944301035993","cumPVCF":"28.7761439374116"},{"date_pmt":"2028-03-30","amt_cashflow":"1.285","N":"27.8260869565217","PVF":"0.689515357765673","PVCF":"0.88602723472889","cumPVCF":"29.6621711721405"},{"date_pmt":"2028-09-30","amt_cashflow":"1.285","N":"28.8260869565217","PVF":"0.680364455834696","PVCF":"0.874268325747585","cumPVCF":"30.5364394978881"},{"date_pmt":"2029-03-30","amt_cashflow":"1.285","N":"29.8260869565217","PVF":"0.671335000083572","PVCF":"0.86266547510739","cumPVCF":"31.3991049729955"},{"date_pmt":"2029-09-30","amt_cashflow":"1.285","N":"30.8260869565217","PVF":"0.662425378739525","PVCF":"0.85121661168029","cumPVCF":"32.2503215846758"},{"date_pmt":"2030-03-30","amt_cashflow":"1.285","N":"31.8260869565217","PVF":"0.653634001420421","PVCF":"0.839919691825241","cumPVCF":"33.090241276501"},{"date_pmt":"2030-09-30","amt_cashflow":"1.285","N":"32.8260869565217","PVF":"0.644959298850877","PVCF":"0.828772699023376","cumPVCF":"33.9190139755244"},{"date_pmt":"2031-03-30","amt_cashflow":"1.285","N":"33.8260869565217","PVF":"0.636399722582147","PVCF":"0.817773643518059","cumPVCF":"34.7367876190424"},{"date_pmt":"2031-09-30","amt_cashflow":"1.285","N":"34.8260869565217","PVF":"0.62795374471572","PVCF":"0.806920561959701","cumPVCF":"35.5437081810021"},{"date_pmt":"2032-03-30","amt_cashflow":"1.285","N":"35.8260869565217","PVF":"0.619619857630589","PVCF":"0.796211517055307","cumPVCF":"36.3399196980575"},{"date_pmt":"2032-09-30","amt_cashflow":"1.285","N":"36.8260869565217","PVF":"0.611396573714134","PVCF":"0.785644597222662","cumPVCF":"37.1255642952801"},{"date_pmt":"2033-03-30","amt_cashflow":"1.285","N":"37.8260869565217","PVF":"0.603282425096585","PVCF":"0.775217916249112","cumPVCF":"37.9007822115292"},{"date_pmt":"2033-09-30","amt_cashflow":"1.285","N":"38.8260869565217","PVF":"0.595275963389003","PVCF":"0.764929612954869","cumPVCF":"38.6657118244841"},{"date_pmt":"2034-03-30","amt_cashflow":"1.285","N":"39.8260869565217","PVF":"0.58737575942474","PVCF":"0.754777850860791","cumPVCF":"39.4204896753449"},{"date_pmt":"2034-09-30","amt_cashflow":"101.285","N":"40.8260869565217","PVF":"0.579580403004332","PVCF":"58.7028011182937","cumPVCF":"98.1232907936386"}]}

Here's an example with a negative yield.

SELECT *

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

                   '2014-09-30', --@Maturity

                   0.0257,       --@Rate

                   -0.046219,    --@Yield

                   98,           --@Redemption

                   2,            --@Frequency

                   0,            --@Basis

                   NULL,         --@Issue

                   NULL,         --@FirstCoupon

                   NULL          --@LastCoupon

               );

This produces the following result.

{"columns":[{"field":"date_pmt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt_cashflow","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cumPVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_pmt":"2014-05-01","amt_cashflow":"-0.221305555555556","N":"0","PVF":"1","PVCF":"-0.221305555555556","cumPVCF":"-0.221305555555556"},{"date_pmt":"2014-09-30","amt_cashflow":"99.285","N":"0.827777777777778","PVF":"1.01950260625788","PVCF":"101.221316262313","cumPVCF":"101.000010706758"}]}

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

SELECT *

FROM wct.BONDCF(   '2014-10-01', --@Settlement

                   '2023-03-13', --@Maturity

                   0.1250,       --@Rate

                   0.1100,       --@Yield

                   100,          --@Redemption

                   182,          --@Frequency

                   9,            --@Basis

                   NULL,         --@Issue

                   NULL,         --@FirstCoupon

                   NULL          --@LastCoupon

               );

This produces the following result.

{"columns":[{"field":"date_pmt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt_cashflow","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cumPVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_pmt":"2014-10-01","amt_cashflow":"-0.309065934065934","N":"0","PVF":"1","PVCF":"-0.309065934065934","cumPVCF":"-0.309065934065934"},{"date_pmt":"2015-03-23","amt_cashflow":"6.25","N":"0.950549450549451","PVF":"0.950380216478331","PVCF":"5.93987635298957","cumPVCF":"5.63081041892363"},{"date_pmt":"2015-09-21","amt_cashflow":"6.25","N":"1.95054945054945","PVF":"0.900834328415479","PVCF":"5.63021455259675","cumPVCF":"11.2610249715204"},{"date_pmt":"2016-03-21","amt_cashflow":"6.25","N":"2.95054945054945","PVF":"0.853871401341687","PVCF":"5.33669625838554","cumPVCF":"16.5977212299059"},{"date_pmt":"2016-09-19","amt_cashflow":"6.25","N":"3.95054945054945","PVF":"0.809356778522926","PVCF":"5.05847986576829","cumPVCF":"21.6562010956742"},{"date_pmt":"2017-03-20","amt_cashflow":"6.25","N":"4.95054945054945","PVF":"0.767162823244479","PVCF":"4.794767645278","cumPVCF":"26.4509687409522"},{"date_pmt":"2017-09-18","amt_cashflow":"6.25","N":"5.95054945054945","PVF":"0.727168552838369","PVCF":"4.54480345523981","cumPVCF":"30.995772196192"},{"date_pmt":"2018-03-19","amt_cashflow":"6.25","N":"6.95054945054945","PVF":"0.689259291789923","PVCF":"4.30787057368702","cumPVCF":"35.303642769879"},{"date_pmt":"2018-09-17","amt_cashflow":"6.25","N":"7.95054945054945","PVF":"0.653326342928837","PVCF":"4.08328964330523","cumPVCF":"39.3869324131843"},{"date_pmt":"2019-03-18","amt_cashflow":"6.25","N":"8.95054945054945","PVF":"0.619266675761931","PVCF":"3.87041672351207","cumPVCF":"43.2573491366963"},{"date_pmt":"2019-09-16","amt_cashflow":"6.25","N":"9.95054945054945","PVF":"0.586982631053963","PVCF":"3.66864144408727","cumPVCF":"46.9259905807836"},{"date_pmt":"2020-03-16","amt_cashflow":"6.25","N":"10.9505494505495","PVF":"0.556381640809444","PVCF":"3.47738525505902","cumPVCF":"50.4033758358426"},{"date_pmt":"2020-09-14","amt_cashflow":"6.25","N":"11.9505494505495","PVF":"0.527375962852553","PVCF":"3.29609976782846","cumPVCF":"53.6994756036711"},{"date_pmt":"2021-03-15","amt_cashflow":"6.25","N":"12.9505494505495","PVF":"0.499882429244126","PVCF":"3.12426518277579","cumPVCF":"56.8237407864469"},{"date_pmt":"2021-09-13","amt_cashflow":"6.25","N":"13.9505494505495","PVF":"0.473822207814338","PVCF":"2.96138879883961","cumPVCF":"59.7851295852865"},{"date_pmt":"2022-03-14","amt_cashflow":"6.25","N":"14.9505494505495","PVF":"0.449120576127334","PVCF":"2.80700360079584","cumPVCF":"62.5921331860823"},{"date_pmt":"2022-09-12","amt_cashflow":"6.25","N":"15.9505494505495","PVF":"0.425706707229701","PVCF":"2.66066692018563","cumPVCF":"65.252800106268"},{"date_pmt":"2023-03-13","amt_cashflow":"106.25","N":"16.9505494505495","PVF":"0.403513466568437","PVCF":"42.8733058228964","cumPVCF":"108.126105929164"}]}

Here's an example of a bond with odd short first coupon settling on the issue date of the bond.

SELECT *

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

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

                   0.0250,       --@Rate

                   0.0276,       --@Yield

                   100,          --@Redemption

                   2,            --@Frequency

                   1,            --@Basis

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

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

                   NULL          --@LastCoupon

               );

This produces the following result.

{"columns":[{"field":"date_pmt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt_cashflow","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cumPVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_pmt":"2014-05-01","amt_cashflow":"0","N":"0","PVF":"1","PVCF":"0","cumPVCF":"0"},{"date_pmt":"2014-06-15","amt_cashflow":"0.309065934065934","N":"0.247252747252747","PVF":"0.996616976475482","PVCF":"0.308020356740362","cumPVCF":"0.308020356740362"},{"date_pmt":"2014-12-15","amt_cashflow":"1.25","N":"1.24725274725275","PVF":"0.983050874408643","PVCF":"1.2288135930108","cumPVCF":"1.53683394975117"},{"date_pmt":"2015-06-15","amt_cashflow":"1.25","N":"2.24725274725275","PVF":"0.969669436189231","PVCF":"1.21208679523654","cumPVCF":"2.7489207449877"},{"date_pmt":"2015-12-15","amt_cashflow":"1.25","N":"3.24725274725275","PVF":"0.956470148144833","PVCF":"1.19558768518104","cumPVCF":"3.94450843016875"},{"date_pmt":"2016-06-15","amt_cashflow":"1.25","N":"4.24725274725275","PVF":"0.943450530819523","PVCF":"1.1793131635244","cumPVCF":"5.12382159369315"},{"date_pmt":"2016-12-15","amt_cashflow":"1.25","N":"5.24725274725275","PVF":"0.930608138508111","PVCF":"1.16326017313514","cumPVCF":"6.28708176682829"},{"date_pmt":"2017-06-15","amt_cashflow":"1.25","N":"6.24725274725275","PVF":"0.917940558796717","PVCF":"1.1474256984959","cumPVCF":"7.43450746532418"},{"date_pmt":"2017-12-15","amt_cashflow":"1.25","N":"7.24725274725275","PVF":"0.905445412109604","PVCF":"1.131806765137","cumPVCF":"8.56631423046119"},{"date_pmt":"2018-06-15","amt_cashflow":"1.25","N":"8.24725274725275","PVF":"0.893120351262186","PVCF":"1.11640043907773","cumPVCF":"9.68271466953892"},{"date_pmt":"2018-12-15","amt_cashflow":"1.25","N":"9.24725274725275","PVF":"0.880963061020108","PVCF":"1.10120382627514","cumPVCF":"10.7839184958141"},{"date_pmt":"2019-06-15","amt_cashflow":"1.25","N":"10.2472527472527","PVF":"0.86897125766434","PVCF":"1.08621407208043","cumPVCF":"11.8701325678945"},{"date_pmt":"2019-12-15","amt_cashflow":"1.25","N":"11.2472527472527","PVF":"0.857142688562182","PVCF":"1.07142836070273","cumPVCF":"12.9415609285972"},{"date_pmt":"2020-06-15","amt_cashflow":"1.25","N":"12.2472527472527","PVF":"0.845475131744113","PVCF":"1.05684391468014","cumPVCF":"13.9984048432774"},{"date_pmt":"2020-12-15","amt_cashflow":"1.25","N":"13.2472527472527","PVF":"0.833966395486401","PVCF":"1.042457994358","cumPVCF":"15.0408628376354"},{"date_pmt":"2021-06-15","amt_cashflow":"1.25","N":"14.2472527472527","PVF":"0.822614317899389","PVCF":"1.02826789737424","cumPVCF":"16.0691307350096"},{"date_pmt":"2021-12-15","amt_cashflow":"1.25","N":"15.2472527472527","PVF":"0.811416766521394","PVCF":"1.01427095815174","cumPVCF":"17.0834016931613"},{"date_pmt":"2022-06-15","amt_cashflow":"1.25","N":"16.2472527472527","PVF":"0.800371637918124","PVCF":"1.00046454739766","cumPVCF":"18.083866240559"},{"date_pmt":"2022-12-15","amt_cashflow":"1.25","N":"17.2472527472527","PVF":"0.789476857287556","PVCF":"0.986846071609445","cumPVCF":"19.0707123121684"},{"date_pmt":"2023-06-15","amt_cashflow":"1.25","N":"18.2472527472527","PVF":"0.778730378070187","PVCF":"0.973412972587734","cumPVCF":"20.0441252847562"},{"date_pmt":"2023-12-15","amt_cashflow":"1.25","N":"19.2472527472527","PVF":"0.768130181564596","PVCF":"0.960162726955745","cumPVCF":"21.0042880117119"},{"date_pmt":"2024-06-15","amt_cashflow":"1.25","N":"20.2472527472527","PVF":"0.75767427654823","PVCF":"0.947092845685288","cumPVCF":"21.9513808573972"},{"date_pmt":"2024-12-15","amt_cashflow":"1.25","N":"21.2472527472527","PVF":"0.747360698903364","PVCF":"0.934200873629205","cumPVCF":"22.8855817310264"},{"date_pmt":"2025-06-15","amt_cashflow":"1.25","N":"22.2472527472527","PVF":"0.737187511248139","PVCF":"0.921484389060174","cumPVCF":"23.8070661200866"},{"date_pmt":"2025-12-15","amt_cashflow":"1.25","N":"23.2472527472527","PVF":"0.727152802572637","PVCF":"0.908941003215796","cumPVCF":"24.7160071233024"},{"date_pmt":"2026-06-15","amt_cashflow":"1.25","N":"24.2472527472527","PVF":"0.717254687879894","PVCF":"0.896568359849868","cumPVCF":"25.6125754831522"},{"date_pmt":"2026-12-15","amt_cashflow":"1.25","N":"25.2472527472527","PVF":"0.707491307831815","PVCF":"0.884364134789769","cumPVCF":"26.496939617942"},{"date_pmt":"2027-06-15","amt_cashflow":"1.25","N":"26.2472527472527","PVF":"0.697860828399897","PVCF":"0.872326035499871","cumPVCF":"27.3692656534419"},{"date_pmt":"2027-12-15","amt_cashflow":"1.25","N":"27.2472527472527","PVF":"0.688361440520711","PVCF":"0.860451800650889","cumPVCF":"28.2297174540928"},{"date_pmt":"2028-06-15","amt_cashflow":"1.25","N":"28.2472527472527","PVF":"0.678991359756077","PVCF":"0.848739199695096","cumPVCF":"29.0784566537879"},{"date_pmt":"2028-12-15","amt_cashflow":"1.25","N":"29.2472527472527","PVF":"0.669748825957859","PVCF":"0.837186032447323","cumPVCF":"29.9156426862352"},{"date_pmt":"2029-06-15","amt_cashflow":"1.25","N":"30.2472527472527","PVF":"0.660632102937323","PVCF":"0.825790128671654","cumPVCF":"30.7414328149068"},{"date_pmt":"2029-12-15","amt_cashflow":"1.25","N":"31.2472527472527","PVF":"0.651639478139005","PVCF":"0.814549347673756","cumPVCF":"31.5559821625806"},{"date_pmt":"2030-06-15","amt_cashflow":"1.25","N":"32.2472527472527","PVF":"0.642769262319003","PVCF":"0.803461577898754","cumPVCF":"32.3594437404794"},{"date_pmt":"2030-12-15","amt_cashflow":"1.25","N":"33.2472527472527","PVF":"0.634019789227661","PVCF":"0.792524736534576","cumPVCF":"33.1519684770139"},{"date_pmt":"2031-06-15","amt_cashflow":"1.25","N":"34.2472527472527","PVF":"0.625389415296568","PVCF":"0.781736769120711","cumPVCF":"33.9337052461346"},{"date_pmt":"2031-12-15","amt_cashflow":"1.25","N":"35.2472527472527","PVF":"0.616876519329817","PVCF":"0.771095649162271","cumPVCF":"34.7048008952969"},{"date_pmt":"2032-06-15","amt_cashflow":"1.25","N":"36.2472527472527","PVF":"0.608479502199464","PVCF":"0.76059937774933","cumPVCF":"35.4654002730462"},{"date_pmt":"2032-12-15","amt_cashflow":"1.25","N":"37.2472527472527","PVF":"0.600196786545141","PVCF":"0.750245983181427","cumPVCF":"36.2156462562277"},{"date_pmt":"2033-06-15","amt_cashflow":"1.25","N":"38.2472527472527","PVF":"0.592026816477748","PVCF":"0.740033520597185","cumPVCF":"36.9556797768249"},{"date_pmt":"2033-12-15","amt_cashflow":"1.25","N":"39.2472527472527","PVF":"0.583968057287185","PVCF":"0.729960071608981","cumPVCF":"37.6856398484338"},{"date_pmt":"2034-06-15","amt_cashflow":"101.25","N":"40.2472527472527","PVF":"0.576018995154059","PVCF":"58.3219232593485","cumPVCF":"96.0075631077823"}]}

This is a bond with an odd long first coupon, also settling on the issue date.

SELECT *

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

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

                   0.0250,       --@Rate

                   0.0276,       --@Yield

                   100,          --@Redemption

                   2,            --@Frequency

                   1,            --@Basis

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

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

                   NULL          --@LastCoupon

               );

This produces the following result.

{"columns":[{"field":"date_pmt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt_cashflow","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cumPVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_pmt":"2014-05-01","amt_cashflow":"0","N":"0","PVF":"1","PVCF":"0","cumPVCF":"0"},{"date_pmt":"2014-12-15","amt_cashflow":"1.55906593406593","N":"1.24725274725275","PVF":"0.983050874408643","PVCF":"1.53264112974424","cumPVCF":"1.53264112974424"},{"date_pmt":"2015-06-15","amt_cashflow":"1.25","N":"2.24725274725275","PVF":"0.969669436189231","PVCF":"1.21208679523654","cumPVCF":"2.74472792498078"},{"date_pmt":"2015-12-15","amt_cashflow":"1.25","N":"3.24725274725275","PVF":"0.956470148144833","PVCF":"1.19558768518104","cumPVCF":"3.94031561016182"},{"date_pmt":"2016-06-15","amt_cashflow":"1.25","N":"4.24725274725275","PVF":"0.943450530819523","PVCF":"1.1793131635244","cumPVCF":"5.11962877368623"},{"date_pmt":"2016-12-15","amt_cashflow":"1.25","N":"5.24725274725275","PVF":"0.930608138508111","PVCF":"1.16326017313514","cumPVCF":"6.28288894682137"},{"date_pmt":"2017-06-15","amt_cashflow":"1.25","N":"6.24725274725275","PVF":"0.917940558796717","PVCF":"1.1474256984959","cumPVCF":"7.43031464531726"},{"date_pmt":"2017-12-15","amt_cashflow":"1.25","N":"7.24725274725275","PVF":"0.905445412109604","PVCF":"1.131806765137","cumPVCF":"8.56212141045427"},{"date_pmt":"2018-06-15","amt_cashflow":"1.25","N":"8.24725274725275","PVF":"0.893120351262186","PVCF":"1.11640043907773","cumPVCF":"9.678521849532"},{"date_pmt":"2018-12-15","amt_cashflow":"1.25","N":"9.24725274725275","PVF":"0.880963061020108","PVCF":"1.10120382627514","cumPVCF":"10.7797256758071"},{"date_pmt":"2019-06-15","amt_cashflow":"1.25","N":"10.2472527472527","PVF":"0.86897125766434","PVCF":"1.08621407208043","cumPVCF":"11.8659397478876"},{"date_pmt":"2019-12-15","amt_cashflow":"1.25","N":"11.2472527472527","PVF":"0.857142688562182","PVCF":"1.07142836070273","cumPVCF":"12.9373681085903"},{"date_pmt":"2020-06-15","amt_cashflow":"1.25","N":"12.2472527472527","PVF":"0.845475131744113","PVCF":"1.05684391468014","cumPVCF":"13.9942120232704"},{"date_pmt":"2020-12-15","amt_cashflow":"1.25","N":"13.2472527472527","PVF":"0.833966395486401","PVCF":"1.042457994358","cumPVCF":"15.0366700176284"},{"date_pmt":"2021-06-15","amt_cashflow":"1.25","N":"14.2472527472527","PVF":"0.822614317899389","PVCF":"1.02826789737424","cumPVCF":"16.0649379150027"},{"date_pmt":"2021-12-15","amt_cashflow":"1.25","N":"15.2472527472527","PVF":"0.811416766521394","PVCF":"1.01427095815174","cumPVCF":"17.0792088731544"},{"date_pmt":"2022-06-15","amt_cashflow":"1.25","N":"16.2472527472527","PVF":"0.800371637918124","PVCF":"1.00046454739766","cumPVCF":"18.0796734205521"},{"date_pmt":"2022-12-15","amt_cashflow":"1.25","N":"17.2472527472527","PVF":"0.789476857287556","PVCF":"0.986846071609445","cumPVCF":"19.0665194921615"},{"date_pmt":"2023-06-15","amt_cashflow":"1.25","N":"18.2472527472527","PVF":"0.778730378070187","PVCF":"0.973412972587734","cumPVCF":"20.0399324647492"},{"date_pmt":"2023-12-15","amt_cashflow":"1.25","N":"19.2472527472527","PVF":"0.768130181564596","PVCF":"0.960162726955745","cumPVCF":"21.000095191705"},{"date_pmt":"2024-06-15","amt_cashflow":"1.25","N":"20.2472527472527","PVF":"0.75767427654823","PVCF":"0.947092845685288","cumPVCF":"21.9471880373903"},{"date_pmt":"2024-12-15","amt_cashflow":"1.25","N":"21.2472527472527","PVF":"0.747360698903364","PVCF":"0.934200873629205","cumPVCF":"22.8813889110195"},{"date_pmt":"2025-06-15","amt_cashflow":"1.25","N":"22.2472527472527","PVF":"0.737187511248139","PVCF":"0.921484389060174","cumPVCF":"23.8028733000797"},{"date_pmt":"2025-12-15","amt_cashflow":"1.25","N":"23.2472527472527","PVF":"0.727152802572637","PVCF":"0.908941003215796","cumPVCF":"24.7118143032955"},{"date_pmt":"2026-06-15","amt_cashflow":"1.25","N":"24.2472527472527","PVF":"0.717254687879894","PVCF":"0.896568359849868","cumPVCF":"25.6083826631453"},{"date_pmt":"2026-12-15","amt_cashflow":"1.25","N":"25.2472527472527","PVF":"0.707491307831815","PVCF":"0.884364134789769","cumPVCF":"26.4927467979351"},{"date_pmt":"2027-06-15","amt_cashflow":"1.25","N":"26.2472527472527","PVF":"0.697860828399897","PVCF":"0.872326035499871","cumPVCF":"27.365072833435"},{"date_pmt":"2027-12-15","amt_cashflow":"1.25","N":"27.2472527472527","PVF":"0.688361440520711","PVCF":"0.860451800650889","cumPVCF":"28.2255246340859"},{"date_pmt":"2028-06-15","amt_cashflow":"1.25","N":"28.2472527472527","PVF":"0.678991359756077","PVCF":"0.848739199695096","cumPVCF":"29.0742638337809"},{"date_pmt":"2028-12-15","amt_cashflow":"1.25","N":"29.2472527472527","PVF":"0.669748825957859","PVCF":"0.837186032447323","cumPVCF":"29.9114498662283"},{"date_pmt":"2029-06-15","amt_cashflow":"1.25","N":"30.2472527472527","PVF":"0.660632102937323","PVCF":"0.825790128671654","cumPVCF":"30.7372399948999"},{"date_pmt":"2029-12-15","amt_cashflow":"1.25","N":"31.2472527472527","PVF":"0.651639478139005","PVCF":"0.814549347673756","cumPVCF":"31.5517893425737"},{"date_pmt":"2030-06-15","amt_cashflow":"1.25","N":"32.2472527472527","PVF":"0.642769262319003","PVCF":"0.803461577898754","cumPVCF":"32.3552509204724"},{"date_pmt":"2030-12-15","amt_cashflow":"1.25","N":"33.2472527472527","PVF":"0.634019789227661","PVCF":"0.792524736534576","cumPVCF":"33.147775657007"},{"date_pmt":"2031-06-15","amt_cashflow":"1.25","N":"34.2472527472527","PVF":"0.625389415296568","PVCF":"0.781736769120711","cumPVCF":"33.9295124261277"},{"date_pmt":"2031-12-15","amt_cashflow":"1.25","N":"35.2472527472527","PVF":"0.616876519329817","PVCF":"0.771095649162271","cumPVCF":"34.70060807529"},{"date_pmt":"2032-06-15","amt_cashflow":"1.25","N":"36.2472527472527","PVF":"0.608479502199464","PVCF":"0.76059937774933","cumPVCF":"35.4612074530393"},{"date_pmt":"2032-12-15","amt_cashflow":"1.25","N":"37.2472527472527","PVF":"0.600196786545141","PVCF":"0.750245983181427","cumPVCF":"36.2114534362208"},{"date_pmt":"2033-06-15","amt_cashflow":"1.25","N":"38.2472527472527","PVF":"0.592026816477748","PVCF":"0.740033520597185","cumPVCF":"36.9514869568179"},{"date_pmt":"2033-12-15","amt_cashflow":"1.25","N":"39.2472527472527","PVF":"0.583968057287185","PVCF":"0.729960071608981","cumPVCF":"37.6814470284269"},{"date_pmt":"2034-06-15","amt_cashflow":"101.25","N":"40.2472527472527","PVF":"0.576018995154059","PVCF":"58.3219232593485","cumPVCF":"96.0033702877754"}]}

In this example, the settlement date of the bond is after the issue date and the coupon payments are due on the 30th of March and the 30th of September.

SELECT *

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

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

                   0.0257,       --@Rate

                   0.0269,       --@Yield

                   100,          --@Redemption

                   2,            --@Frequency

                   11,           --@Basis

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

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

                   NULL          --@LastCoupon

               );

This produces the following result.

{"columns":[{"field":"date_pmt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt_cashflow","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cumPVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_pmt":"2014-03-15","amt_cashflow":"-0.0993922651933702","N":"0","PVF":"1","PVCF":"-0.0993922651933702","cumPVCF":"-0.0993922651933702"},{"date_pmt":"2014-03-30","amt_cashflow":"0.205883977900552","N":"0.0828729281767956","PVF":"0.998893401265451","PVCF":"0.205656146951144","cumPVCF":"0.106263881757774"},{"date_pmt":"2014-09-30","amt_cashflow":"1.285","N":"1.0828729281768","PVF":"0.985636589141498","PVCF":"1.26654301704682","cumPVCF":"1.3728068988046"},{"date_pmt":"2015-03-30","amt_cashflow":"1.285","N":"2.0828729281768","PVF":"0.972555714777737","PVCF":"1.24973409348939","cumPVCF":"2.62254099229399"},{"date_pmt":"2015-09-30","amt_cashflow":"1.285","N":"3.0828729281768","PVF":"0.959648443216476","PVCF":"1.23314824953317","cumPVCF":"3.85568924182716"},{"date_pmt":"2016-03-30","amt_cashflow":"1.285","N":"4.0828729281768","PVF":"0.946912470488407","PVCF":"1.2167825245776","cumPVCF":"5.07247176640476"},{"date_pmt":"2016-09-30","amt_cashflow":"1.285","N":"5.0828729281768","PVF":"0.934345523201348","PVCF":"1.20063399731373","cumPVCF":"6.2731057637185"},{"date_pmt":"2017-03-30","amt_cashflow":"1.285","N":"6.0828729281768","PVF":"0.92194535813444","PVCF":"1.18469978520276","cumPVCF":"7.45780554892125"},{"date_pmt":"2017-09-30","amt_cashflow":"1.285","N":"7.0828729281768","PVF":"0.909709761837723","PVCF":"1.16897704396147","cumPVCF":"8.62678259288273"},{"date_pmt":"2018-03-30","amt_cashflow":"1.285","N":"8.0828729281768","PVF":"0.897636550237035","PVCF":"1.15346296705459","cumPVCF":"9.78024555993732"},{"date_pmt":"2018-09-30","amt_cashflow":"1.285","N":"9.0828729281768","PVF":"0.885723568244151","PVCF":"1.13815478519373","cumPVCF":"10.9184003451311"},{"date_pmt":"2019-03-30","amt_cashflow":"1.285","N":"10.0828729281768","PVF":"0.873968689372096","PVCF":"1.12304976584314","cumPVCF":"12.0414501109742"},{"date_pmt":"2019-09-30","amt_cashflow":"1.285","N":"11.0828729281768","PVF":"0.862369815355564","PVCF":"1.1081452127319","cumPVCF":"13.1495953237061"},{"date_pmt":"2020-03-30","amt_cashflow":"1.285","N":"12.0828729281768","PVF":"0.850924875776372","PVCF":"1.09343846537264","cumPVCF":"14.2430337890787"},{"date_pmt":"2020-09-30","amt_cashflow":"1.285","N":"13.0828729281768","PVF":"0.839631827693889","PVCF":"1.07892689858665","cumPVCF":"15.3219606876654"},{"date_pmt":"2021-03-30","amt_cashflow":"1.285","N":"14.0828729281768","PVF":"0.828488655280368","PVCF":"1.06460792203527","cumPVCF":"16.3865686097007"},{"date_pmt":"2021-09-30","amt_cashflow":"1.285","N":"15.0828729281768","PVF":"0.817493369461116","PVCF":"1.05047897975753","cumPVCF":"17.4370475894582"},{"date_pmt":"2022-03-30","amt_cashflow":"1.285","N":"16.0828729281768","PVF":"0.806644007559442","PVCF":"1.03653754971388","cumPVCF":"18.4735851391721"},{"date_pmt":"2022-09-30","amt_cashflow":"1.285","N":"17.0828729281768","PVF":"0.795938632946314","PVCF":"1.02278114333601","cumPVCF":"19.4963662825081"},{"date_pmt":"2023-03-30","amt_cashflow":"1.285","N":"18.0828729281768","PVF":"0.78537533469467","PVCF":"1.00920730508265","cumPVCF":"20.5055735875907"},{"date_pmt":"2023-09-30","amt_cashflow":"1.285","N":"19.0828729281768","PVF":"0.774952227238315","PVCF":"0.995813612001235","cumPVCF":"21.501387199592"},{"date_pmt":"2024-03-30","amt_cashflow":"1.285","N":"20.0828729281768","PVF":"0.76466745003534","PVCF":"0.982597673295412","cumPVCF":"22.4839848728874"},{"date_pmt":"2024-09-30","amt_cashflow":"1.285","N":"21.0828729281768","PVF":"0.754519167236015","PVCF":"0.96955712989828","cumPVCF":"23.4535420027857"},{"date_pmt":"2025-03-30","amt_cashflow":"1.285","N":"22.0828729281768","PVF":"0.744505567355089","PVCF":"0.95668965405129","cumPVCF":"24.410231656837"},{"date_pmt":"2025-09-30","amt_cashflow":"1.285","N":"23.0828729281768","PVF":"0.734624862948433","PVCF":"0.943992948888737","cumPVCF":"25.3542246057257"},{"date_pmt":"2026-03-30","amt_cashflow":"1.285","N":"24.0828729281768","PVF":"0.724875290293979","PVCF":"0.931464748027763","cumPVCF":"26.2856893537535"},{"date_pmt":"2026-09-30","amt_cashflow":"1.285","N":"25.0828729281768","PVF":"0.715255109076895","PVCF":"0.91910281516381","cumPVCF":"27.2047921689173"},{"date_pmt":"2027-03-30","amt_cashflow":"1.285","N":"26.0828729281768","PVF":"0.705762602078933","PVCF":"0.906904943671429","cumPVCF":"28.1116971125887"},{"date_pmt":"2027-09-30","amt_cashflow":"1.285","N":"27.0828729281768","PVF":"0.696396074871906","PVCF":"0.894868956210399","cumPVCF":"29.0065660687991"},{"date_pmt":"2028-03-30","amt_cashflow":"1.285","N":"28.0828729281768","PVF":"0.687153855515226","PVCF":"0.882992704337066","cumPVCF":"29.8895587731362"},{"date_pmt":"2028-09-30","amt_cashflow":"1.285","N":"29.0828729281768","PVF":"0.678034294257463","PVCF":"0.87127406812084","cumPVCF":"30.760832841257"},{"date_pmt":"2029-03-30","amt_cashflow":"1.285","N":"30.0828729281768","PVF":"0.66903576324186","PVCF":"0.859710955765791","cumPVCF":"31.6205437970228"},{"date_pmt":"2029-09-30","amt_cashflow":"1.285","N":"31.0828729281768","PVF":"0.660156656215758","PVCF":"0.84830130323725","cumPVCF":"32.46884510026"},{"date_pmt":"2030-03-30","amt_cashflow":"1.285","N":"32.0828729281768","PVF":"0.651395388243878","PVCF":"0.837043073893384","cumPVCF":"33.3058881741534"},{"date_pmt":"2030-09-30","amt_cashflow":"1.285","N":"33.0828729281768","PVF":"0.642750395425406","PVCF":"0.825934258121647","cumPVCF":"34.1318224322751"},{"date_pmt":"2031-03-30","amt_cashflow":"1.285","N":"34.0828729281768","PVF":"0.634220134614837","PVCF":"0.814972872980066","cumPVCF":"34.9467953052551"},{"date_pmt":"2031-09-30","amt_cashflow":"1.285","N":"35.0828729281768","PVF":"0.625803083146516","PVCF":"0.804156961843274","cumPVCF":"35.7509522670984"},{"date_pmt":"2032-03-30","amt_cashflow":"1.285","N":"36.0828729281768","PVF":"0.617497738562846","PVCF":"0.793484594053257","cumPVCF":"36.5444368611517"},{"date_pmt":"2032-09-30","amt_cashflow":"1.285","N":"37.0828729281768","PVF":"0.609302618346091","PVCF":"0.782953864574727","cumPVCF":"37.3273907257264"},{"date_pmt":"2033-03-30","amt_cashflow":"1.285","N":"38.0828729281768","PVF":"0.601216259653748","PVCF":"0.772562893655067","cumPVCF":"38.0999536193815"},{"date_pmt":"2033-09-30","amt_cashflow":"1.285","N":"39.0828729281768","PVF":"0.593237219057426","PVCF":"0.762309826488792","cumPVCF":"38.8622634458703"},{"date_pmt":"2034-03-30","amt_cashflow":"1.285","N":"40.0828729281768","PVF":"0.58536407228519","PVCF":"0.752192832886469","cumPVCF":"39.6144562787567"},{"date_pmt":"2034-09-30","amt_cashflow":"101.285","N":"41.0828729281768","PVF":"0.57759541396733","PVCF":"58.501751503681","cumPVCF":"98.1162077824377"}]}

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

SELECT *

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

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

                   0.1250,       --@Rate

                   0.1100,       --@Yield

                   100,          --@Redemption

                   182,          --@Frequency

                   9,            --@Basis

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

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

                   NULL          --@LastCoupon

               );

This produces the following result.

{"columns":[{"field":"date_pmt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt_cashflow","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cumPVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_pmt":"2014-10-04","amt_cashflow":"-6.59340659340659","N":"0","PVF":"1","PVCF":"-6.59340659340659","cumPVCF":"-6.59340659340659"},{"date_pmt":"2014-12-31","amt_cashflow":"9.61538461538462","N":"0.483516483516484","PVF":"0.974444373896921","PVCF":"9.36965744131655","cumPVCF":"2.77625084790996"},{"date_pmt":"2015-07-01","amt_cashflow":"6.25","N":"1.48351648351648","PVF":"0.923643956300399","PVCF":"5.7727747268775","cumPVCF":"8.54902557478745"},{"date_pmt":"2015-12-30","amt_cashflow":"6.25","N":"2.48351648351648","PVF":"0.87549190170654","PVCF":"5.47182438566587","cumPVCF":"14.0208499604533"},{"date_pmt":"2016-06-29","amt_cashflow":"6.25","N":"3.48351648351648","PVF":"0.829850143797668","PVCF":"5.18656339873542","cumPVCF":"19.2074133591887"},{"date_pmt":"2016-12-28","amt_cashflow":"6.25","N":"4.48351648351648","PVF":"0.786587814026226","PVCF":"4.91617383766391","cumPVCF":"24.1235871968527"},{"date_pmt":"2017-06-28","amt_cashflow":"6.25","N":"5.48351648351648","PVF":"0.745580866375569","PVCF":"4.65988041484731","cumPVCF":"28.7834676117"},{"date_pmt":"2017-12-27","amt_cashflow":"6.25","N":"6.48351648351648","PVF":"0.706711721683004","PVCF":"4.41694826051878","cumPVCF":"33.2004158722187"},{"date_pmt":"2018-06-27","amt_cashflow":"6.25","N":"7.48351648351648","PVF":"0.669868930505217","PVCF":"4.18668081565761","cumPVCF":"37.3870966878764"},{"date_pmt":"2018-12-26","amt_cashflow":"6.25","N":"8.48351648351648","PVF":"0.634946853559448","PVCF":"3.96841783474655","cumPVCF":"41.3555145226229"},{"date_pmt":"2019-06-26","amt_cashflow":"6.25","N":"9.48351648351648","PVF":"0.601845358824121","PVCF":"3.76153349265076","cumPVCF":"45.1170480152737"},{"date_pmt":"2019-12-25","amt_cashflow":"6.25","N":"10.4835164835165","PVF":"0.570469534430446","PVCF":"3.56543459019029","cumPVCF":"48.6824826054639"},{"date_pmt":"2020-06-24","amt_cashflow":"6.25","N":"11.4835164835165","PVF":"0.54072941652175","PVCF":"3.37955885326094","cumPVCF":"52.0620414587249"},{"date_pmt":"2020-12-23","amt_cashflow":"6.25","N":"12.4835164835165","PVF":"0.512539731300237","PVCF":"3.20337332062648","cumPVCF":"55.2654147793514"},{"date_pmt":"2021-06-23","amt_cashflow":"6.25","N":"13.4835164835165","PVF":"0.485819650521552","PVCF":"3.0363728157597","cumPVCF":"58.3017875951111"},{"date_pmt":"2021-12-22","amt_cashflow":"6.25","N":"14.4835164835165","PVF":"0.460492559736068","PVCF":"2.87807849835043","cumPVCF":"61.1798660934615"},{"date_pmt":"2022-06-22","amt_cashflow":"6.25","N":"15.4835164835165","PVF":"0.436485838612387","PVCF":"2.72803649132742","cumPVCF":"63.9079025847889"},{"date_pmt":"2022-12-21","amt_cashflow":"6.25","N":"16.4835164835165","PVF":"0.413730652713163","PVCF":"2.58581657945727","cumPVCF":"66.4937191642462"},{"date_pmt":"2023-06-21","amt_cashflow":"6.25","N":"17.4835164835165","PVF":"0.392161756126221","PVCF":"2.45101097578888","cumPVCF":"68.944730140035"},{"date_pmt":"2023-12-20","amt_cashflow":"6.25","N":"18.4835164835165","PVF":"0.371717304385043","PVCF":"2.32323315240652","cumPVCF":"71.2679632924416"},{"date_pmt":"2024-06-19","amt_cashflow":"6.25","N":"19.4835164835165","PVF":"0.352338677142221","PVCF":"2.20211673213888","cumPVCF":"73.4700800245804"},{"date_pmt":"2024-12-18","amt_cashflow":"6.25","N":"20.4835164835165","PVF":"0.333970310087414","PVCF":"2.08731443804633","cumPVCF":"75.5573944626268"},{"date_pmt":"2025-06-18","amt_cashflow":"6.25","N":"21.4835164835165","PVF":"0.31655953562788","PVCF":"1.97849709767425","cumPVCF":"77.535891560301"},{"date_pmt":"2025-12-17","amt_cashflow":"6.25","N":"22.4835164835165","PVF":"0.300056431874768","PVCF":"1.8753526992173","cumPVCF":"79.4112442595183"},{"date_pmt":"2026-06-17","amt_cashflow":"6.25","N":"23.4835164835165","PVF":"0.28441367950215","PVCF":"1.77758549688844","cumPVCF":"81.1888297564068"},{"date_pmt":"2026-12-16","amt_cashflow":"6.25","N":"24.4835164835165","PVF":"0.269586426068388","PVCF":"1.68491516292743","cumPVCF":"82.8737449193342"},{"date_pmt":"2027-06-16","amt_cashflow":"6.25","N":"25.4835164835165","PVF":"0.255532157410795","PVCF":"1.59707598381747","cumPVCF":"84.4708209031516"},{"date_pmt":"2027-12-15","amt_cashflow":"6.25","N":"26.4835164835165","PVF":"0.242210575744829","PVCF":"1.51381609840518","cumPVCF":"85.9846370015568"},{"date_pmt":"2028-06-14","amt_cashflow":"6.25","N":"27.4835164835165","PVF":"0.229583484118321","PVCF":"1.43489677573951","cumPVCF":"87.4195337772963"},{"date_pmt":"2028-12-13","amt_cashflow":"6.25","N":"28.4835164835165","PVF":"0.217614676889404","PVCF":"1.36009173055878","cumPVCF":"88.7796255078551"},{"date_pmt":"2029-06-13","amt_cashflow":"6.25","N":"29.4835164835165","PVF":"0.206269835914127","PVCF":"1.28918647446329","cumPVCF":"90.0688119823184"},{"date_pmt":"2029-12-12","amt_cashflow":"106.25","N":"30.4835164835165","PVF":"0.195516432146092","PVCF":"20.7736209155223","cumPVCF":"110.842432897841"}]}

This is a bond with an odd short last coupon settling in the last coupon period.

SELECT *

FROM wct.BONDCF(   '2014-10-01', --@Settlement

                   '2014-12-15', --@Maturity

                   0.0225,       --@Rate

                   0.0010,       --@Yield

                   100,          --@Redemption

                   2,            --@Frequency

                   1,            --@Basis

                   NULL,         --@Issue

                   NULL,         --@FirstCoupon

                   '2014-09-15'  --@LastCoupon

               );

This produces the following result.

{"columns":[{"field":"date_pmt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt_cashflow","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cumPVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_pmt":"2014-10-01","amt_cashflow":"-0.0994475138121547","N":"0","PVF":"1","PVCF":"-0.0994475138121547","cumPVCF":"-0.0994475138121547"},{"date_pmt":"2014-12-15","amt_cashflow":"100.565607734807","N":"0.414364640883978","PVF":"0.999792860595181","PVCF":"100.544776634675","cumPVCF":"100.445329120863"}]}

This is a bond with an odd long last coupon settling in the final period.

SELECT *

FROM wct.BONDCF(   '2014-10-01', --@Settlement

                   '2014-12-15', --@Maturity

                   0.0225,       --@Rate

                   0.0010,       --@Yield

                   100,          --@Redemption

                   2,            --@Frequency

                   1,            --@Basis

                   NULL,         --@Issue

                   NULL,         --@FirstCoupon

                   '2014-03-15'  --@LastCoupon

               );

This produces the following result.

{"columns":[{"field":"date_pmt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt_cashflow","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cumPVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_pmt":"2014-10-01","amt_cashflow":"-1.22444751381215","N":"0","PVF":"1","PVCF":"-1.22444751381215","cumPVCF":"-1.22444751381215"},{"date_pmt":"2014-12-15","amt_cashflow":"101.690607734807","N":"0.414364640883978","PVF":"0.999792860595181","PVCF":"101.669543602845","cumPVCF":"100.445096089033"}]}

This is a bond with an odd short last coupon settling before the last coupon date.

SELECT *

FROM wct.BONDCF(   '2014-10-01', --@Settlement

                   '2034-12-15', --@Maturity

                   0.0425,       --@Rate

                   0.0400,       --@Yield

                   100,          --@Redemption

                   2,            --@Frequency

                   1,            --@Basis

                   NULL,         --@Issue

                   NULL,         --@FirstCoupon

                   '2034-09-15'  --@LastCoupon

               );

This produces the following result.

{"columns":[{"field":"date_pmt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt_cashflow","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cumPVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_pmt":"2014-10-01","amt_cashflow":"-0.187845303867403","N":"0","PVF":"1","PVCF":"-0.187845303867403","cumPVCF":"-0.187845303867403"},{"date_pmt":"2015-03-15","amt_cashflow":"2.125","N":"0.911602209944751","PVF":"0.982109844632016","PVCF":"2.08698341984303","cumPVCF":"1.89913811597563"},{"date_pmt":"2015-09-15","amt_cashflow":"2.125","N":"1.91160220994475","PVF":"0.962852788854918","PVCF":"2.0460621763167","cumPVCF":"3.94520029229233"},{"date_pmt":"2016-03-15","amt_cashflow":"2.125","N":"2.91160220994475","PVF":"0.943973322406782","PVCF":"2.00594331011441","cumPVCF":"5.95114360240675"},{"date_pmt":"2016-09-15","amt_cashflow":"2.125","N":"3.91160220994475","PVF":"0.925464041575277","PVCF":"1.96661108834746","cumPVCF":"7.91775469075421"},{"date_pmt":"2017-03-15","amt_cashflow":"2.125","N":"4.91160220994475","PVF":"0.907317687818899","PVCF":"1.92805008661516","cumPVCF":"9.84580477736937"},{"date_pmt":"2017-09-15","amt_cashflow":"2.125","N":"5.91160220994475","PVF":"0.889527144920489","PVCF":"1.89024518295604","cumPVCF":"11.7360499603254"},{"date_pmt":"2018-03-15","amt_cashflow":"2.125","N":"6.91160220994475","PVF":"0.872085436196558","PVCF":"1.85318155191769","cumPVCF":"13.5892315122431"},{"date_pmt":"2018-09-15","amt_cashflow":"2.125","N":"7.91160220994475","PVF":"0.854985721761331","PVCF":"1.81684465874283","cumPVCF":"15.4060761709859"},{"date_pmt":"2019-03-15","amt_cashflow":"2.125","N":"8.91160220994475","PVF":"0.838221295844442","PVCF":"1.78122025366944","cumPVCF":"17.1872964246554"},{"date_pmt":"2019-09-15","amt_cashflow":"2.125","N":"9.91160220994475","PVF":"0.821785584161218","PVCF":"1.74629436634259","cumPVCF":"18.933590790998"},{"date_pmt":"2020-03-15","amt_cashflow":"2.125","N":"10.9116022099448","PVF":"0.805672141334527","PVCF":"1.71205330033587","cumPVCF":"20.6456440913338"},{"date_pmt":"2020-09-15","amt_cashflow":"2.125","N":"11.9116022099448","PVF":"0.789874648367184","PVCF":"1.67848362778027","cumPVCF":"22.3241277191141"},{"date_pmt":"2021-03-15","amt_cashflow":"2.125","N":"12.9116022099448","PVF":"0.774386910163905","PVCF":"1.6455721840983","cumPVCF":"23.9696999032124"},{"date_pmt":"2021-09-15","amt_cashflow":"2.125","N":"13.9116022099448","PVF":"0.759202853101868","PVCF":"1.61330606284147","cumPVCF":"25.5830059660539"},{"date_pmt":"2022-03-15","amt_cashflow":"2.125","N":"14.9116022099448","PVF":"0.74431652264889","PVCF":"1.58167261062889","cumPVCF":"27.1646785766828"},{"date_pmt":"2022-09-15","amt_cashflow":"2.125","N":"15.9116022099448","PVF":"0.729722081028324","PVCF":"1.55065942218519","cumPVCF":"28.7153379988679"},{"date_pmt":"2023-03-15","amt_cashflow":"2.125","N":"16.9116022099448","PVF":"0.715413804929729","PVCF":"1.52025433547567","cumPVCF":"30.2355923343436"},{"date_pmt":"2023-09-15","amt_cashflow":"2.125","N":"17.9116022099448","PVF":"0.70138608326444","PVCF":"1.49044542693694","cumPVCF":"31.7260377612805"},{"date_pmt":"2024-03-15","amt_cashflow":"2.125","N":"18.9116022099448","PVF":"0.687633414965137","PVCF":"1.46122100680092","cumPVCF":"33.1872587680815"},{"date_pmt":"2024-09-15","amt_cashflow":"2.125","N":"19.9116022099448","PVF":"0.674150406828566","PVCF":"1.4325696145107","cumPVCF":"34.6198283825922"},{"date_pmt":"2025-03-15","amt_cashflow":"2.125","N":"20.9116022099448","PVF":"0.660931771400555","PVCF":"1.40448001422618","cumPVCF":"36.0243083968183"},{"date_pmt":"2025-09-15","amt_cashflow":"2.125","N":"21.9116022099448","PVF":"0.647972324902505","PVCF":"1.37694119041782","cumPVCF":"37.4012495872362"},{"date_pmt":"2026-03-15","amt_cashflow":"2.125","N":"22.9116022099448","PVF":"0.635266985198534","PVCF":"1.34994234354688","cumPVCF":"38.7511919307831"},{"date_pmt":"2026-09-15","amt_cashflow":"2.125","N":"23.9116022099448","PVF":"0.622810769802484","PVCF":"1.32347288583028","cumPVCF":"40.0746648166133"},{"date_pmt":"2027-03-15","amt_cashflow":"2.125","N":"24.9116022099448","PVF":"0.610598793924004","PVCF":"1.29752243708851","cumPVCF":"41.3721872537018"},{"date_pmt":"2027-09-15","amt_cashflow":"2.125","N":"25.9116022099448","PVF":"0.598626268552945","PVCF":"1.27208082067501","cumPVCF":"42.6442680743769"},{"date_pmt":"2028-03-15","amt_cashflow":"2.125","N":"26.9116022099448","PVF":"0.586888498581319","PVCF":"1.2471380594853","cumPVCF":"43.8914061338622"},{"date_pmt":"2028-09-15","amt_cashflow":"2.125","N":"27.9116022099448","PVF":"0.575380880962077","PVCF":"1.22268437204441","cumPVCF":"45.1140905059066"},{"date_pmt":"2029-03-15","amt_cashflow":"2.125","N":"28.9116022099448","PVF":"0.564098902903997","PVCF":"1.19871016867099","cumPVCF":"46.3128006745776"},{"date_pmt":"2029-09-15","amt_cashflow":"2.125","N":"29.9116022099448","PVF":"0.553038140101958","PVCF":"1.17520604771666","cumPVCF":"47.4880067222942"},{"date_pmt":"2030-03-15","amt_cashflow":"2.125","N":"30.9116022099448","PVF":"0.54219425500192","PVCF":"1.15216279187908","cumPVCF":"48.6401695141733"},{"date_pmt":"2030-09-15","amt_cashflow":"2.125","N":"31.9116022099448","PVF":"0.531562995099921","PVCF":"1.12957136458733","cumPVCF":"49.7697408787606"},{"date_pmt":"2031-03-15","amt_cashflow":"2.125","N":"32.9116022099448","PVF":"0.521140191274433","PVCF":"1.10742290645817","cumPVCF":"50.8771637852188"},{"date_pmt":"2031-09-15","amt_cashflow":"2.125","N":"33.9116022099448","PVF":"0.510921756151405","PVCF":"1.08570873182173","cumPVCF":"51.9628725170405"},{"date_pmt":"2032-03-15","amt_cashflow":"2.125","N":"34.9116022099448","PVF":"0.500903682501377","PVCF":"1.06442032531543","cumPVCF":"53.027292842356"},{"date_pmt":"2032-09-15","amt_cashflow":"2.125","N":"35.9116022099448","PVF":"0.491082041668017","PVCF":"1.04354933854454","cumPVCF":"54.0708421809005"},{"date_pmt":"2033-03-15","amt_cashflow":"2.125","N":"36.9116022099448","PVF":"0.481452982027467","PVCF":"1.02308758680837","cumPVCF":"55.0939297677089"},{"date_pmt":"2033-09-15","amt_cashflow":"2.125","N":"37.9116022099448","PVF":"0.472012727477909","PVCF":"1.00302704589056","cumPVCF":"56.0969568135994"},{"date_pmt":"2034-03-15","amt_cashflow":"2.125","N":"38.9116022099448","PVF":"0.462757575958734","PVCF":"0.98335984891231","cumPVCF":"57.0803166625117"},{"date_pmt":"2034-09-15","amt_cashflow":"2.125","N":"39.9116022099448","PVF":"0.453683897998759","PVCF":"0.964078283247363","cumPVCF":"58.0443949457591"},{"date_pmt":"2034-12-15","amt_cashflow":"101.068370165746","N":"40.414364640884","PVF":"0.449189424035058","PVCF":"45.3988429829134","cumPVCF":"103.443237928672"}]}

This is a bond with an odd long last coupon settling before the last coupon date.

SELECT *

FROM wct.BONDCF(   '2014-10-01', --@Settlement

                   '2034-12-15', --@Maturity

                   0.0425,       --@Rate

                   0.0400,       --@Yield

                   100,          --@Redemption

                   2,            --@Frequency

                   1,            --@Basis

                   NULL,         --@Issue

                   NULL,         --@FirstCoupon

                   '2034-03-15'  --@LastCoupon

               );

This produces the following result.

{"columns":[{"field":"date_pmt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt_cashflow","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cumPVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_pmt":"2014-10-01","amt_cashflow":"-0.187845303867403","N":"0","PVF":"1","PVCF":"-0.187845303867403","cumPVCF":"-0.187845303867403"},{"date_pmt":"2015-03-15","amt_cashflow":"2.125","N":"0.911602209944751","PVF":"0.982109844632016","PVCF":"2.08698341984303","cumPVCF":"1.89913811597563"},{"date_pmt":"2015-09-15","amt_cashflow":"2.125","N":"1.91160220994475","PVF":"0.962852788854918","PVCF":"2.0460621763167","cumPVCF":"3.94520029229233"},{"date_pmt":"2016-03-15","amt_cashflow":"2.125","N":"2.91160220994475","PVF":"0.943973322406782","PVCF":"2.00594331011441","cumPVCF":"5.95114360240675"},{"date_pmt":"2016-09-15","amt_cashflow":"2.125","N":"3.91160220994475","PVF":"0.925464041575277","PVCF":"1.96661108834746","cumPVCF":"7.91775469075421"},{"date_pmt":"2017-03-15","amt_cashflow":"2.125","N":"4.91160220994475","PVF":"0.907317687818899","PVCF":"1.92805008661516","cumPVCF":"9.84580477736937"},{"date_pmt":"2017-09-15","amt_cashflow":"2.125","N":"5.91160220994475","PVF":"0.889527144920489","PVCF":"1.89024518295604","cumPVCF":"11.7360499603254"},{"date_pmt":"2018-03-15","amt_cashflow":"2.125","N":"6.91160220994475","PVF":"0.872085436196558","PVCF":"1.85318155191769","cumPVCF":"13.5892315122431"},{"date_pmt":"2018-09-15","amt_cashflow":"2.125","N":"7.91160220994475","PVF":"0.854985721761331","PVCF":"1.81684465874283","cumPVCF":"15.4060761709859"},{"date_pmt":"2019-03-15","amt_cashflow":"2.125","N":"8.91160220994475","PVF":"0.838221295844442","PVCF":"1.78122025366944","cumPVCF":"17.1872964246554"},{"date_pmt":"2019-09-15","amt_cashflow":"2.125","N":"9.91160220994475","PVF":"0.821785584161218","PVCF":"1.74629436634259","cumPVCF":"18.933590790998"},{"date_pmt":"2020-03-15","amt_cashflow":"2.125","N":"10.9116022099448","PVF":"0.805672141334527","PVCF":"1.71205330033587","cumPVCF":"20.6456440913338"},{"date_pmt":"2020-09-15","amt_cashflow":"2.125","N":"11.9116022099448","PVF":"0.789874648367184","PVCF":"1.67848362778027","cumPVCF":"22.3241277191141"},{"date_pmt":"2021-03-15","amt_cashflow":"2.125","N":"12.9116022099448","PVF":"0.774386910163905","PVCF":"1.6455721840983","cumPVCF":"23.9696999032124"},{"date_pmt":"2021-09-15","amt_cashflow":"2.125","N":"13.9116022099448","PVF":"0.759202853101868","PVCF":"1.61330606284147","cumPVCF":"25.5830059660539"},{"date_pmt":"2022-03-15","amt_cashflow":"2.125","N":"14.9116022099448","PVF":"0.74431652264889","PVCF":"1.58167261062889","cumPVCF":"27.1646785766828"},{"date_pmt":"2022-09-15","amt_cashflow":"2.125","N":"15.9116022099448","PVF":"0.729722081028324","PVCF":"1.55065942218519","cumPVCF":"28.7153379988679"},{"date_pmt":"2023-03-15","amt_cashflow":"2.125","N":"16.9116022099448","PVF":"0.715413804929729","PVCF":"1.52025433547567","cumPVCF":"30.2355923343436"},{"date_pmt":"2023-09-15","amt_cashflow":"2.125","N":"17.9116022099448","PVF":"0.70138608326444","PVCF":"1.49044542693694","cumPVCF":"31.7260377612805"},{"date_pmt":"2024-03-15","amt_cashflow":"2.125","N":"18.9116022099448","PVF":"0.687633414965137","PVCF":"1.46122100680092","cumPVCF":"33.1872587680815"},{"date_pmt":"2024-09-15","amt_cashflow":"2.125","N":"19.9116022099448","PVF":"0.674150406828566","PVCF":"1.4325696145107","cumPVCF":"34.6198283825922"},{"date_pmt":"2025-03-15","amt_cashflow":"2.125","N":"20.9116022099448","PVF":"0.660931771400555","PVCF":"1.40448001422618","cumPVCF":"36.0243083968183"},{"date_pmt":"2025-09-15","amt_cashflow":"2.125","N":"21.9116022099448","PVF":"0.647972324902505","PVCF":"1.37694119041782","cumPVCF":"37.4012495872362"},{"date_pmt":"2026-03-15","amt_cashflow":"2.125","N":"22.9116022099448","PVF":"0.635266985198534","PVCF":"1.34994234354688","cumPVCF":"38.7511919307831"},{"date_pmt":"2026-09-15","amt_cashflow":"2.125","N":"23.9116022099448","PVF":"0.622810769802484","PVCF":"1.32347288583028","cumPVCF":"40.0746648166133"},{"date_pmt":"2027-03-15","amt_cashflow":"2.125","N":"24.9116022099448","PVF":"0.610598793924004","PVCF":"1.29752243708851","cumPVCF":"41.3721872537018"},{"date_pmt":"2027-09-15","amt_cashflow":"2.125","N":"25.9116022099448","PVF":"0.598626268552945","PVCF":"1.27208082067501","cumPVCF":"42.6442680743769"},{"date_pmt":"2028-03-15","amt_cashflow":"2.125","N":"26.9116022099448","PVF":"0.586888498581319","PVCF":"1.2471380594853","cumPVCF":"43.8914061338622"},{"date_pmt":"2028-09-15","amt_cashflow":"2.125","N":"27.9116022099448","PVF":"0.575380880962077","PVCF":"1.22268437204441","cumPVCF":"45.1140905059066"},{"date_pmt":"2029-03-15","amt_cashflow":"2.125","N":"28.9116022099448","PVF":"0.564098902903997","PVCF":"1.19871016867099","cumPVCF":"46.3128006745776"},{"date_pmt":"2029-09-15","amt_cashflow":"2.125","N":"29.9116022099448","PVF":"0.553038140101958","PVCF":"1.17520604771666","cumPVCF":"47.4880067222942"},{"date_pmt":"2030-03-15","amt_cashflow":"2.125","N":"30.9116022099448","PVF":"0.54219425500192","PVCF":"1.15216279187908","cumPVCF":"48.6401695141733"},{"date_pmt":"2030-09-15","amt_cashflow":"2.125","N":"31.9116022099448","PVF":"0.531562995099921","PVCF":"1.12957136458733","cumPVCF":"49.7697408787606"},{"date_pmt":"2031-03-15","amt_cashflow":"2.125","N":"32.9116022099448","PVF":"0.521140191274433","PVCF":"1.10742290645817","cumPVCF":"50.8771637852188"},{"date_pmt":"2031-09-15","amt_cashflow":"2.125","N":"33.9116022099448","PVF":"0.510921756151405","PVCF":"1.08570873182173","cumPVCF":"51.9628725170405"},{"date_pmt":"2032-03-15","amt_cashflow":"2.125","N":"34.9116022099448","PVF":"0.500903682501377","PVCF":"1.06442032531543","cumPVCF":"53.027292842356"},{"date_pmt":"2032-09-15","amt_cashflow":"2.125","N":"35.9116022099448","PVF":"0.491082041668017","PVCF":"1.04354933854454","cumPVCF":"54.0708421809005"},{"date_pmt":"2033-03-15","amt_cashflow":"2.125","N":"36.9116022099448","PVF":"0.481452982027467","PVCF":"1.02308758680837","cumPVCF":"55.0939297677089"},{"date_pmt":"2033-09-15","amt_cashflow":"2.125","N":"37.9116022099448","PVF":"0.472012727477909","PVCF":"1.00302704589056","cumPVCF":"56.0969568135994"},{"date_pmt":"2034-03-15","amt_cashflow":"2.125","N":"38.9116022099448","PVF":"0.462757575958734","PVCF":"0.98335984891231","cumPVCF":"57.0803166625117"},{"date_pmt":"2034-12-15","amt_cashflow":"103.193370165746","N":"40.414364640884","PVF":"0.449189424035058","PVCF":"46.3533705089879","cumPVCF":"103.4336871715"}]}

This is a bond with an odd long first coupon and an odd long last coupon.

SELECT *

FROM wct.BONDCF(   '2013-03-04', --@Settlement

                   '2022-11-28', --@Maturity

                   0.03125,      --@Rate

                   0.02875,      --@Yield

                   100,          --@Redemption

                   2,            --@Frequency

                   1,            --@Basis

                   '2012-06-07', --@Issue

                   '2013-03-15', --@FirstCoupon

                   '2022-03-15'  --@LastCoupon

               );

This produces the following result.

{"columns":[{"field":"date_pmt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt_cashflow","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cumPVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_pmt":"2013-03-04","amt_cashflow":"-2.31672621907278","N":"0","PVF":"1","PVCF":"-2.31672621907278","cumPVCF":"-2.31672621907278"},{"date_pmt":"2013-03-15","amt_cashflow":"2.4116847826087","N":"0.0607734806629834","PVF":"0.999132976898755","PVCF":"2.40959379618925","cumPVCF":"0.0928675771164698"},{"date_pmt":"2013-09-15","amt_cashflow":"1.5625","N":"1.06077348066298","PVF":"0.984973975993844","PVCF":"1.53902183749038","cumPVCF":"1.63188941460685"},{"date_pmt":"2014-03-15","amt_cashflow":"1.5625","N":"2.06077348066298","PVF":"0.971015626364849","PVCF":"1.51721191619508","cumPVCF":"3.14910133080193"},{"date_pmt":"2014-09-15","amt_cashflow":"1.5625","N":"3.06077348066298","PVF":"0.957255084524805","PVCF":"1.49571106957001","cumPVCF":"4.64481240037193"},{"date_pmt":"2015-03-15","amt_cashflow":"1.5625","N":"4.06077348066298","PVF":"0.943689547282617","PVCF":"1.47451491762909","cumPVCF":"6.11932731800102"},{"date_pmt":"2015-09-15","amt_cashflow":"1.5625","N":"5.06077348066298","PVF":"0.930316251172019","PVCF":"1.45361914245628","cumPVCF":"7.5729464604573"},{"date_pmt":"2016-03-15","amt_cashflow":"1.5625","N":"6.06077348066298","PVF":"0.91713247188862","PVCF":"1.43301948732597","cumPVCF":"9.00596594778327"},{"date_pmt":"2016-09-15","amt_cashflow":"1.5625","N":"7.06077348066298","PVF":"0.904135523734931","PVCF":"1.41271175583583","cumPVCF":"10.4186777036191"},{"date_pmt":"2017-03-15","amt_cashflow":"1.5625","N":"8.06077348066298","PVF":"0.891322759073253","PVCF":"1.39269181105196","cumPVCF":"11.8113695146711"},{"date_pmt":"2017-09-15","amt_cashflow":"1.5625","N":"9.06077348066298","PVF":"0.878691567786324","PVCF":"1.37295557466613","cumPVCF":"13.1843250893372"},{"date_pmt":"2018-03-15","amt_cashflow":"1.5625","N":"10.060773480663","PVF":"0.866239376745606","PVCF":"1.35349902616501","cumPVCF":"14.5378241155022"},{"date_pmt":"2018-09-15","amt_cashflow":"1.5625","N":"11.060773480663","PVF":"0.853963649287104","PVCF":"1.3343182020111","cumPVCF":"15.8721423175133"},{"date_pmt":"2019-03-15","amt_cashflow":"1.5625","N":"12.060773480663","PVF":"0.841861884694619","PVCF":"1.31540919483534","cumPVCF":"17.1875515123486"},{"date_pmt":"2019-09-15","amt_cashflow":"1.5625","N":"13.060773480663","PVF":"0.829931617690321","PVCF":"1.29676815264113","cumPVCF":"18.4843196649898"},{"date_pmt":"2020-03-15","amt_cashflow":"1.5625","N":"14.060773480663","PVF":"0.81817041793254","PVCF":"1.27839127801959","cumPVCF":"19.7627109430094"},{"date_pmt":"2020-09-15","amt_cashflow":"1.5625","N":"15.060773480663","PVF":"0.80657588952068","PVCF":"1.26027482737606","cumPVCF":"21.0229857703854"},{"date_pmt":"2021-03-15","amt_cashflow":"1.5625","N":"16.060773480663","PVF":"0.79514567050714","PVCF":"1.24241511016741","cumPVCF":"22.2654008805528"},{"date_pmt":"2021-09-15","amt_cashflow":"1.5625","N":"17.060773480663","PVF":"0.783877432416158","PVCF":"1.22480848815025","cumPVCF":"23.4902093687031"},{"date_pmt":"2022-03-15","amt_cashflow":"1.5625","N":"18.060773480663","PVF":"0.772768879769472","PVCF":"1.2074513746398","cumPVCF":"24.6976607433429"},{"date_pmt":"2022-11-28","amt_cashflow":"102.201312154696","N":"19.4696132596685","PVF":"0.757385311895596","PVCF":"77.4057726824236","cumPVCF":"102.103433425767"}]}

This is a bond with an odd long first coupon and an odd short last coupon.

SELECT *

FROM wct.BONDCF(   '2013-03-04', --@Settlement

                   '2022-04-28', --@Maturity

                   0.03125,      --@Rate

                   0.02875,      --@Yield

                   100,          --@Redemption

                   2,            --@Frequency

                   1,            --@Basis

                   '2012-06-07', --@Issue

                   '2013-03-15', --@FirstCoupon

                   '2022-03-15'  --@LastCoupon

               );

This produces the following result.

{"columns":[{"field":"date_pmt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt_cashflow","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cumPVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_pmt":"2013-03-04","amt_cashflow":"-2.31672621907278","N":"0","PVF":"1","PVCF":"-2.31672621907278","cumPVCF":"-2.31672621907278"},{"date_pmt":"2013-03-15","amt_cashflow":"2.4116847826087","N":"0.0607734806629834","PVF":"0.999132976898755","PVCF":"2.40959379618925","cumPVCF":"0.0928675771164698"},{"date_pmt":"2013-09-15","amt_cashflow":"1.5625","N":"1.06077348066298","PVF":"0.984973975993844","PVCF":"1.53902183749038","cumPVCF":"1.63188941460685"},{"date_pmt":"2014-03-15","amt_cashflow":"1.5625","N":"2.06077348066298","PVF":"0.971015626364849","PVCF":"1.51721191619508","cumPVCF":"3.14910133080193"},{"date_pmt":"2014-09-15","amt_cashflow":"1.5625","N":"3.06077348066298","PVF":"0.957255084524805","PVCF":"1.49571106957001","cumPVCF":"4.64481240037193"},{"date_pmt":"2015-03-15","amt_cashflow":"1.5625","N":"4.06077348066298","PVF":"0.943689547282617","PVCF":"1.47451491762909","cumPVCF":"6.11932731800102"},{"date_pmt":"2015-09-15","amt_cashflow":"1.5625","N":"5.06077348066298","PVF":"0.930316251172019","PVCF":"1.45361914245628","cumPVCF":"7.5729464604573"},{"date_pmt":"2016-03-15","amt_cashflow":"1.5625","N":"6.06077348066298","PVF":"0.91713247188862","PVCF":"1.43301948732597","cumPVCF":"9.00596594778327"},{"date_pmt":"2016-09-15","amt_cashflow":"1.5625","N":"7.06077348066298","PVF":"0.904135523734931","PVCF":"1.41271175583583","cumPVCF":"10.4186777036191"},{"date_pmt":"2017-03-15","amt_cashflow":"1.5625","N":"8.06077348066298","PVF":"0.891322759073253","PVCF":"1.39269181105196","cumPVCF":"11.8113695146711"},{"date_pmt":"2017-09-15","amt_cashflow":"1.5625","N":"9.06077348066298","PVF":"0.878691567786324","PVCF":"1.37295557466613","cumPVCF":"13.1843250893372"},{"date_pmt":"2018-03-15","amt_cashflow":"1.5625","N":"10.060773480663","PVF":"0.866239376745606","PVCF":"1.35349902616501","cumPVCF":"14.5378241155022"},{"date_pmt":"2018-09-15","amt_cashflow":"1.5625","N":"11.060773480663","PVF":"0.853963649287104","PVCF":"1.3343182020111","cumPVCF":"15.8721423175133"},{"date_pmt":"2019-03-15","amt_cashflow":"1.5625","N":"12.060773480663","PVF":"0.841861884694619","PVCF":"1.31540919483534","cumPVCF":"17.1875515123486"},{"date_pmt":"2019-09-15","amt_cashflow":"1.5625","N":"13.060773480663","PVF":"0.829931617690321","PVCF":"1.29676815264113","cumPVCF":"18.4843196649898"},{"date_pmt":"2020-03-15","amt_cashflow":"1.5625","N":"14.060773480663","PVF":"0.81817041793254","PVCF":"1.27839127801959","cumPVCF":"19.7627109430094"},{"date_pmt":"2020-09-15","amt_cashflow":"1.5625","N":"15.060773480663","PVF":"0.80657588952068","PVCF":"1.26027482737606","cumPVCF":"21.0229857703854"},{"date_pmt":"2021-03-15","amt_cashflow":"1.5625","N":"16.060773480663","PVF":"0.79514567050714","PVCF":"1.24241511016741","cumPVCF":"22.2654008805528"},{"date_pmt":"2021-09-15","amt_cashflow":"1.5625","N":"17.060773480663","PVF":"0.783877432416158","PVCF":"1.22480848815025","cumPVCF":"23.4902093687031"},{"date_pmt":"2022-03-15","amt_cashflow":"1.5625","N":"18.060773480663","PVF":"0.772768879769472","PVCF":"1.2074513746398","cumPVCF":"24.6976607433429"},{"date_pmt":"2022-04-28","amt_cashflow":"100.373641304348","N":"18.2999039154456","PVF":"0.770135894328887","PVCF":"77.3013440129708","cumPVCF":"101.999004756314"}]}

This is a bond with an odd short first coupon and an odd long last coupon.

SELECT *

FROM wct.BONDCF(   '2013-03-04', --@Settlement

                   '2022-11-28', --@Maturity

                   0.03125,      --@Rate

                   0.02875,      --@Yield

                   100,          --@Redemption

                   2,            --@Frequency

                   1,            --@Basis

                   '2012-12-07', --@Issue

                   '2013-03-15', --@FirstCoupon

                   '2022-03-15'  --@LastCoupon

               );

This produces the following result.

{"columns":[{"field":"date_pmt","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"amt_cashflow","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"N","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"PVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"cumPVCF","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"date_pmt":"2013-03-04","amt_cashflow":"-0.75103591160221","N":"0","PVF":"1","PVCF":"-0.75103591160221","cumPVCF":"-0.75103591160221"},{"date_pmt":"2013-03-15","amt_cashflow":"0.845994475138122","N":"0.0607734806629834","PVF":"0.999132976898755","PVCF":"0.845260978384651","cumPVCF":"0.0942250667824414"},{"date_pmt":"2013-09-15","amt_cashflow":"1.5625","N":"1.06077348066298","PVF":"0.984973975993844","PVCF":"1.53902183749038","cumPVCF":"1.63324690427282"},{"date_pmt":"2014-03-15","amt_cashflow":"1.5625","N":"2.06077348066298","PVF":"0.971015626364849","PVCF":"1.51721191619508","cumPVCF":"3.1504588204679"},{"date_pmt":"2014-09-15","amt_cashflow":"1.5625","N":"3.06077348066298","PVF":"0.957255084524805","PVCF":"1.49571106957001","cumPVCF":"4.64616989003791"},{"date_pmt":"2015-03-15","amt_cashflow":"1.5625","N":"4.06077348066298","PVF":"0.943689547282617","PVCF":"1.47451491762909","cumPVCF":"6.120684807667"},{"date_pmt":"2015-09-15","amt_cashflow":"1.5625","N":"5.06077348066298","PVF":"0.930316251172019","PVCF":"1.45361914245628","cumPVCF":"7.57430395012328"},{"date_pmt":"2016-03-15","amt_cashflow":"1.5625","N":"6.06077348066298","PVF":"0.91713247188862","PVCF":"1.43301948732597","cumPVCF":"9.00732343744924"},{"date_pmt":"2016-09-15","amt_cashflow":"1.5625","N":"7.06077348066298","PVF":"0.904135523734931","PVCF":"1.41271175583583","cumPVCF":"10.4200351932851"},{"date_pmt":"2017-03-15","amt_cashflow":"1.5625","N":"8.06077348066298","PVF":"0.891322759073253","PVCF":"1.39269181105196","cumPVCF":"11.812727004337"},{"date_pmt":"2017-09-15","amt_cashflow":"1.5625","N":"9.06077348066298","PVF":"0.878691567786324","PVCF":"1.37295557466613","cumPVCF":"13.1856825790032"},{"date_pmt":"2018-03-15","amt_cashflow":"1.5625","N":"10.060773480663","PVF":"0.866239376745606","PVCF":"1.35349902616501","cumPVCF":"14.5391816051682"},{"date_pmt":"2018-09-15","amt_cashflow":"1.5625","N":"11.060773480663","PVF":"0.853963649287104","PVCF":"1.3343182020111","cumPVCF":"15.8734998071793"},{"date_pmt":"2019-03-15","amt_cashflow":"1.5625","N":"12.060773480663","PVF":"0.841861884694619","PVCF":"1.31540919483534","cumPVCF":"17.1889090020146"},{"date_pmt":"2019-09-15","amt_cashflow":"1.5625","N":"13.060773480663","PVF":"0.829931617690321","PVCF":"1.29676815264113","cumPVCF":"18.4856771546557"},{"date_pmt":"2020-03-15","amt_cashflow":"1.5625","N":"14.060773480663","PVF":"0.81817041793254","PVCF":"1.27839127801959","cumPVCF":"19.7640684326753"},{"date_pmt":"2020-09-15","amt_cashflow":"1.5625","N":"15.060773480663","PVF":"0.80657588952068","PVCF":"1.26027482737606","cumPVCF":"21.0243432600514"},{"date_pmt":"2021-03-15","amt_cashflow":"1.5625","N":"16.060773480663","PVF":"0.79514567050714","PVCF":"1.24241511016741","cumPVCF":"22.2667583702188"},{"date_pmt":"2021-09-15","amt_cashflow":"1.5625","N":"17.060773480663","PVF":"0.783877432416158","PVCF":"1.22480848815025","cumPVCF":"23.491566858369"},{"date_pmt":"2022-03-15","amt_cashflow":"1.5625","N":"18.060773480663","PVF":"0.772768879769472","PVCF":"1.2074513746398","cumPVCF":"24.6990182330088"},{"date_pmt":"2022-11-28","amt_cashflow":"102.201312154696","N":"19.4696132596685","PVF":"0.757385311895596","PVCF":"77.4057726824236","cumPVCF":"102.104790915432"}]}

See Also

BONDINT - Accrued interest on a bond paying regular, periodic interest

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

ODDLINT - Accrued interest for a bond with an odd last coupon

ODDLPRICE - Price of a bond with an odd last coupon

ODDLYIELD - Calculate the YIELD with an odd last period

OFLPRICE - Price of a security with an odd last coupon.

OFLYIELD - Yield of a bond with an odd first and an odd last coupon

PRICE - Price of a bond paying regular periodic interest

YIELD - Yield of a bond paying regular periodic coupon