Interest Rate Swap-Derivative Pricing in Python

Subscribe to newsletter

In a previous post, we presented an example of Interest Rate Swap Pricing in Excel. In this post, we are going to provide an example of interest rate swap pricing in Python. We are going to use the USD Libor swap curve as at December 31 2018. Picture below shows the swap curve.

Interest Rate Swap-Derivative Pricing in Python

USD Swap Curve as at Dec 31, 2018. Source: Bloomberg

Recall that an interest rate swap (IRS) is a financial derivative instrument that involves an exchange of a fixed interest rate for a floating interest rate.  More specifically,

An interest rate swap’s (IRS’s) effective description is a derivative contract, agreed between two counterparties, which specifies the nature of an exchange of payments benchmarked against an interest rate index. The most common IRS is a fixed for floating swap, whereby one party will make payments to the other based on an initially agreed fixed rate of interest, to receive back payments based on a floating interest rate index. Each of these series of payments is termed a ‘leg’, so a typical IRS has both a fixed and a floating leg. The floating index is commonly an interbank offered rate (IBOR) of specific tenor in the appropriate currency of the IRS, for example LIBOR in USD, GBP, EURIBOR in EUR or STIBOR in SEK. To completely determine any IRS a number of parameters must be specified for each leg; the notional principal amount (or varying notional schedule), the start and end dates and date scheduling, the fixed rate, the chosen floating interest rate index tenor, and day count conventions for interest calculations. Read more

Subscribe to newsletter https://harbourfrontquant.beehiiv.com/subscribe Newsletter Covering Trading Strategies, Risk Management, Financial Derivatives, Career Perspectives, and More

The valuation of an interest rate swap proceeds as follows,

  1. Construction of the zero-coupon curve
  2. Determination of the payment schedules
  3. Calculation of the net present value of future cash flows

The hypothetical interest rate swap is as follows,

Maturity: 10 years

Notional: 10 Million USD

Fixed rate: 2.5%

Floating rate:  Libor

Note that we utilize the deposit and swap rates only and ignore the futures prices in the bootstrapping process. The values of the fixed, floating legs and the interest rate swap are calculated using a Python program. We obtain the following result

Interest Rate Swap-Derivative Valuation in Python


To download the accompanying Excel workbook or Python program for this post:
1. Subscribe to the newsletter. If you're already a subscriber, go to the next step
2. Once subscribed, refer a friend
After completing these steps, you’ll gain access to the file for this post, along with files for a dozen other posts.

Subscribe to newsletter https://harbourfrontquant.beehiiv.com/subscribe Newsletter Covering Trading Strategies, Risk Management, Financial Derivatives, Career Perspectives, and More

Further questions

What's your question? Ask it in the discussion forum

Have an answer to the questions below? Post it here or in the forum

LATEST NEWSDeath toll from blast at Iran's Bandar Abbas port rises to 28
Death toll from blast at Iran's Bandar Abbas port rises to 28
Stay up-to-date with the latest news - click here
LATEST NEWS‘It feels personal’: Canadian farmers cope with Chinese tariffs on canola and peas
‘It feels personal’: Canadian farmers cope with Chinese tariffs on canola and peas

MOOSE JAW — Canola runs deep on Margaret Rigetti’s farm in southern Saskatchewan. Her grandfather was among the first to grow the bright yellow flowering crop in the 1970s, and it has been a staple ever since. “For a large part of Saskatchewan, the farm…

Stay up-to-date with the latest news - click here
LATEST NEWSAt least nine killed in Vancouver after vehicle plows into Filipino festival
At least nine killed in Vancouver after vehicle plows into Filipino festival
Stay up-to-date with the latest news - click here
LATEST NEWSTrump’s push to save the fading coal industry gets a warm embrace in West Virginia
Trump’s push to save the fading coal industry gets a warm embrace in West Virginia

FAYETTEVILLE, W.Va. (AP) — The winner of this year’s West Virginia Coal Festival teen beauty pageant walks among the ruins of a community abandoned 70 years ago and imagines the rusted remains of coal tipples and processing plants coming back to life. Ava Johnson knows…

Stay up-to-date with the latest news - click here
LATEST NEWSThings to know about the US coal industry and proposed changes under the Trump administration
Things to know about the US coal industry and proposed changes under the Trump administration

CHARLESTON, W.Va. (AP) — President Donald Trump’s administration has proposed several changes that would affect the struggling U.S. coal industry. Trump issued executive orders this month to allow mining on federal land. He has used his emergency authority to allow some older coal-fired power plants…

Stay up-to-date with the latest news - click here

5 Comments

Leave a Reply to Lee yun seong Cancel reply