Annual (Once per year)
Semi-Annual (Twice per year)
Quarterly (Four times per year)
Enter Forward Rates (%) for each consecutive period
Calculated Par Swap Rate
0.00%
Based on implied Discount Factors
Bootstrap Analysis:
Period
Forward Rate
Discount Factor (DF)
How to Calculate Swap Rate with Forward Rates
In quantitative finance, calculating the par swap rate is a fundamental task for pricing interest rate swaps. An interest rate swap is a derivative contract where two parties exchange cash flows—one based on a fixed rate and the other on a floating rate (typically linked to a benchmark like SOFR or LIBOR). The "swap rate" is the specific fixed rate that makes the net present value (NPV) of the contract zero at inception.
While swap rates are often quoted directly by the market, they can also be derived mathematically using a series of forward rates. Forward rates represent the market's expectation of future interest rates for specific periods.
The Mathematical Relationship
To calculate the swap rate from forward rates, one must typically perform a "bootstrapping" process to determine the Discount Factors (DF) for each payment date. The par swap rate is essentially a weighted average of the forward rates, but weighted by the discount factors rather than time alone.
Swap Rate (S) = (1 – DFₙ) / Σ (Δt × DFᵢ)
Where:
DFₙ is the discount factor at the final maturity date.
DFᵢ is the discount factor for each interim payment period i.
Δt (Delta t) is the accrual period fraction (e.g., 0.5 for semi-annual).
Step-by-Step Calculation Logic
If you have a series of Forward Rates ($f_1, f_2, … f_n$), the process is as follows:
1. Determine Time Fraction (Δt)
First, identify the frequency of payments. If payments are semi-annual, Δt is 0.5. If quarterly, Δt is 0.25.
2. Calculate Discount Factors (DF)
A Discount Factor represents the present value of $1 received at a future date. It is derived from the forward rates using the recurrence relation:
This continues for all periods involved in the swap.
3. Solve for the Swap Rate
The numerator of the swap rate formula represents the total floating leg value (which simplifies to $1 – DF_n$ in a par context). The denominator is the sum of the discount factors multiplied by the time fraction (often called the PV01 or Annuity factor).
Why Use Forward Rates?
Using forward rates allows for a more granular pricing model that accounts for the term structure of interest rates (the yield curve). A simple average of rates would ignore the time value of money, leading to incorrect valuations. By converting forwards to discount factors, we ensure the calculated swap rate implies no arbitrage opportunities.
Example Calculation
Assume a 1-year swap with semi-annual payments (Δt = 0.5). Period 1 Forward Rate: 4.0% Period 2 Forward Rate: 5.0%
function calculateSwapRate() {
// 1. Get Payment Frequency and determine Delta T
var freqElement = document.getElementById('paymentFrequency');
var frequency = parseFloat(freqElement.value);
var deltaT = 1.0 / frequency; // e.g., 0.5 for semi-annual
// 2. Gather Forward Rates
var forwardRates = [];
// We scan inputs fwdRate1 through fwdRate6
for (var i = 1; i <= 6; i++) {
var inputId = 'fwdRate' + i;
var val = document.getElementById(inputId).value;
if (val !== "" && !isNaN(val)) {
forwardRates.push(parseFloat(val) / 100); // Convert % to decimal
} else {
// Stop gathering if we hit an empty input, assuming sequential entry
// If user skips period 2 but enters 3, logic breaks, so we assume sequential.
if (i === 1) {
alert("Please enter at least the Period 1 Forward Rate.");
return;
}
break;
}
}
if (forwardRates.length === 0) return;
// 3. Calculate Discount Factors and Accumulate PV01
var df = 1.0; // Starting DF at time 0
var pv01 = 0.0; // Denominator sum(deltaT * DF)
var breakdownHtml = "";
// Array to store results for table
var results = [];
for (var j = 0; j < forwardRates.length; j++) {
var fwd = forwardRates[j];
// Calculate DF for end of this period
// DF_new = DF_prev / (1 + fwd * deltaT)
var dfPrev = df;
df = dfPrev / (1 + (fwd * deltaT));
// Accumulate denominator (Sum of DeltaT * DF_new)
pv01 += deltaT * df;
// Store data for table
results.push({
period: j + 1,
rate: (fwd * 100).toFixed(2) + "%",
df: df.toFixed(5)
});
}
var finalDF = df;
// 4. Calculate Swap Rate
// Formula: (1 – DF_final) / PV01
var numerator = 1.0 – finalDF;
var swapRateDecimal = numerator / pv01;
var swapRatePercent = (swapRateDecimal * 100).toFixed(4);
// 5. Display Results
var resultSection = document.getElementById('resultSection');
var resultDisplay = document.getElementById('swapRateResult');
var tableBody = document.getElementById('breakdownBody');
resultDisplay.innerHTML = swapRatePercent + "%";
// Populate breakdown table
tableBody.innerHTML = "";
for (var k = 0; k < results.length; k++) {
var row = "