This is really just to elaborate on other contributor's answers:
Generating the cash flow schedule is surprisingly complicated. As a general rule of thumb, the following dates are involved for a swap (though not all of them need to be specified):
- The trade date: This is the date on which the swap is traded, usually "today."
- The effective date: This is when the contract actually settles. For USD swaps, it is 2 business days after the trade date.
- The first interest payment date: This is the date when the first interest payment occurs. For the floating leg of a USD swap, this is usually 3 months after the effective date, though it could be longer than 3 months (long stub) or shorter than 3 months (short stub).
- The penultimate interest payment date: This is the last interest payment before the maturity date. The period between this date and the maturity date can also be longer or shorter than other periods.
- The maturity date: The day on which the final interest rate payment is made and the swap matures.
For most standard swaps, all you need is the trade date and the tenor/term. Using USD standard swap as an example, the cash flows can be generated as follows:
- Given the trade date, the effective date is trade day + 2 business day.
- With the effective date, the maturity date is the effective date + tenor of the swap. To do this date calculation, you also need to understand the "roll day." In this case, the roll day should be determined from the effective date:
- If "end-of-month roll" is off:
- If the effective date is MM-28-YYYY, then the roll day is 28, and the maturity date should also fall on the 28th.
- If the effective date is MM-31-YYYY, then the roll day is 31, and the maturity date should also fall on the 31st (if that's not possible, move it BACK to the end of the month).
- If "end-of-month roll" is on (default for US Treasuries):
- If effective date is month end, all dates in the schedule should also fall on month end.
- Otherwise, use the same rules above.
- The dates between effective date and maturity can be calculated relatively easily, by incrementally adding the payment period to the previous date, using the same roll day determined in the previous step. For floating leg of a USD swap, for example, start from effective date and incrementally add 3 months.
- Finally, go through all the dates again and adjust them for holidays and weekends as needed. USD swaps follow the "Modified Following" convention – if a date is a bad day (i.e., holiday/weekends), you move it to the next good day; unless the next good day is in the next month, in which case you move it backward to the previous good day.
In practice, you need to carefully read both the proper local market convention AND the actual agreement to determine the cash flow schedule.