Overview
A swap is derivative contract where one set of cash flows is swapped for another. The typical swap is constructed to swap a fixed payment for a floating rate payment.
Plain Vanilla Swap
A plain vanilla swap has a set of payment dates defined, here listed as {% t_1, t_2, ... t_n %} and a set of reset dates {% t_0, t_1, ... t_{n-1} %}.
(note - the reset dates are the same as the payment dates except for the first reset date and the last payment date)
On each reset date {% t_i %}, the variable interest is observed, here labeled {% r_{floating} %}. Then, on the next payment date {% t_{i+1} %}, the floating rate payer pays {% N(1 + r_{floating, t_i} \Delta t) %} to the fixed rate payer, who pays the floating rate payer {% N(1+r_{fixed}) %}, where {% N %} is the notional amount specified in the contract.
The notional amount {% N %} is specified at the begging of the contract, and the fixed rate {% r_{fixed} %} is set at initiation so that the contract is worth zero dollars. That is, the parties just enter into the contract without an exchange of money up front.
Plain Vanilla Swap Value
Using the notation, {% P(t_1, t_2) %} as the price at time {% t_1 %} for {% $1 %} received at time {% t_2 %}, the value of the swap to the fixed rate payer at {% t \leq t_0 %} is given by
{% P(t,t_0) - P(t,t_n) - r_{fixed} \Delta t \sum_{i=1}^N P(t,t_i) %}
see back
Note that the first two terms represent the value of floating rate leg
{% floating \; rate \; leg = P(t,t_0) - P(t,t_n) %}
This represents the price of receiving {% $1 %} at time {% t_0 %}, investing it in the floating rate,
receiving the floating rate payments, and then paying the {% $1 %} back at time {% t_n %}.
The value of the fixed rate leg is then given by
{% r_{fixed} \Delta t \sum_{i=1}^N P(t,t_i) %}
{% r_{fixed} \Delta t %} represents the fixed dollar payments each period, and each
{% P(t, t_i) %} are the relevant discount rates.