Forward Rate Calculation

A forward rate is the implied future interest rate on a single investment or loan made at some point in the future, for some period of time. It is derived from the current spot rates for different maturities. This calculator helps you determine the forward rate based on two known spot rates.

function calculateForwardRate() { var spotRate1 = parseFloat(document.getElementById("spotRate1").value); var spotRate2 = document.getElementById("spotRate2").value; var resultDiv = document.getElementById("result"); if (isNaN(spotRate1) || isNaN(spotRate2)) { resultDiv.innerHTML = "Please enter valid numbers for both spot rates."; return; } // Ensure spot rates are treated as decimals (e.g., 5% is 0.05) if (spotRate1 > 1 || spotRate2 > 1) { spotRate1 = spotRate1 / 100; spotRate2 = spotRate2 / 100; } // Formula for forward rate (f1,2) for year 2 derived from spot rates s1 and s2: // (1 + s2)^2 = (1 + s1) * (1 + f1,2) // (1 + f1,2) = (1 + s2)^2 / (1 + s1) // f1,2 = [(1 + s2)^2 / (1 + s1)] – 1 var numerator = Math.pow((1 + spotRate2), 2); var denominator = (1 + spotRate1); if (denominator === 0) { resultDiv.innerHTML = "Cannot calculate forward rate due to invalid spot rate for Year 1."; return; } var forwardRate = (numerator / denominator) – 1; resultDiv.innerHTML = "The implied forward rate for Year 2 is: " + (forwardRate * 100).toFixed(4) + "%"; } .input-group { margin-bottom: 15px; } .input-group label { display: block; margin-bottom: 5px; font-weight: bold; } .input-group input { width: 100%; padding: 8px; box-sizing: border-box; } button { padding: 10px 15px; background-color: #007bff; color: white; border: none; cursor: pointer; } #result { margin-top: 20px; font-weight: bold; color: green; }

Leave a Comment