SWAP (Encyclopedia)

A swap contract is an agreement in which two counterparties exchange financial flows that are calculated according to a specific criterion and at specific dates.
The first type of swap we analyse is the "interest rate swap" (IRS), a contract in which two counterparties exchange interests according to a specific notional amount. 
In this category, we put the fixed versus the floater IRS. With this agreement, one counterparty pays flows of interest related to a specific fixed rate on a specific notional amount, whereas the other counterparty pays flows of interest related to a floating rate (in general, plus or minus a margin). Let’s do an example so that we can understand the utility of IRSs.
Let’s consider a small/medium-size company. In case of new investments, let’s suppose that the company prefers to pay interests on its debt according to a fixed rate, so that the firm knows exactly the cash flows related to this debt at the beginning of the agreement (it is useful if a business plan has to be prepared). Actually, it is hard for a small or medium-size company to have debt at a fixed rate. Furthermore, if the debt is related to a floating rate, in case of an increase in interest rates, the company would face unexpected cash flows (because the rate is not known since it is not fixed from the beginning) that could compromise earning results. 
Let’s consider, on the other hand, a bank that has a fixed rate debt component (e.g., fixed rate bonds issued by the banks, or products sold to retail clients in which the bank has to guarantee a specific yield). Yet, the interbanking market is tipically floating rate oriented (banking loans are indexed to Libor mainly). Therefore, in case of a decrease in interest rates, the bank will continue to pay the higher fixed rate but, in the interbanking money market, rates will have gone down in the meanwhile (in other terms, it receives a lower flow of interest because it is related to floating rates, and it has to pay a fixed rate that is quite high with respect to the new shape of the interest rate curve).
Let’s imagine an agreement between the small/medium-size company and the bank.
The debt is 1 million Euros for both, but the small/medium-size company pays floating rate interests, whereas the bank pays a fixed rate. As mentioned before, they could enter into a swap with a notional amount of one million euros, in which they exchange flows of interests.
In this way, the bank with fixed rate inflows can repay the exposure at fixed rate (i.e., as we have said before, fixed rate bonds issued by the banks, or products sold to retail clients in which the bank has to guarantee a specific yield), protecting itself from a decrease in interest rates; the small/medium-size company, on the other hand, receives variable flows that match its outflows. As a result, the bank actually pays a floating rate, whereas the company pays a fixed rate. 

By the way, we must consider the counterparty risk that is implied in an IRS agreement. The spread is the remuneration for this counterparty credit risk. Still considering the previous example, let’s suppose that the company has a worse credit profile than the bank. If this is the case, the bank will claim a higher interest from the firm (e.g., fixed rate plus 25 or 50 bp) or demand to pay a lower floating rate.
Swap market has incredibly grown over time and IRSs represent only one category of a wide range of possibilities.
In a "currency swap", for instance, two counterparties exchange capital and interests expressed in a specific currency into another currency. Let’s clarify this concept with an example. An Italian manufacturing company sells products in the U.S. area for a global amount of $ 10 million to be received in 90 days. Furthermore, in three months the company will have to pay (in Euros) for materials and workers. If during this three month period, there is a depreciation of the U.S. dollar in the currency market (or Euro appreciation), the company will get $ 10 million and will convert this money into Euros, but in the end it will receive less than what it expected three months earlier, thus compromising the expenses for materials and workers.
By entering into a currency swap and supposing that at the start date 1 euro buys 1.27 U.S. dollars, the Italian company will pay interests calculated on a notional amount of $ 10 million and pay at maturity to the counterparty the notional amount that actually equals the inflows the company will receive in 90 days (from sales, as we have written before). The company will receive interests calculated on a notional of 787,400.00 Euros ($ 1million at 1.27 exchange rate, i.e. 1,000,000/1.27) and the notional amount (i.e., capital component) at maturity. In this way, the currency risk no longer exists for the Italian company. Remember that with IRSs, we want to protect from interest rate risk instead (movements in the rate curve). 
We call "basis swap" an agreement in which counterparties pay interests on two different floating rates on the same notional amount (e.g., the first one pays interests indexed to Libor, whereas the other one considers a floating rate linked to commercial paper). It is mainly adopted by banks and factoring companies.
With an "equity swap", instead, we exchange a specific fixed rate or floating rate versus dividends and capital gain over an equity asset (specific stock or equity index). This is mainly adopted by fund managers and pension funds with a speculative perspective.
Swaps are extremely flexible instruments and can be easily adapted to specific circumstances.
The categories we have explained are the most standardised.
Hull, J. C., "Options, futures and other derivatives" 7th edition, Prentice Hall, 2008 
Fabozzi, F. J., "Bond markets, analysis and strategies", 2004, Pearson Education 
Baxter, M., Rennie, A., "Financial Calculus: An Introduction to Derivative Pricing", Cambridge University Press, 2006