Computational Finance Laboratroy (Python) Final Project
In this project, we create USD LIBOR yield curve
model from market observations, via the methodology in use prior to 2008. It is to support two calculations:
- The discount factor up to 3 years after a given spot date.
- The forward rate which is the simple interest rate, expressed as a percentage, over a given period between two dates, computed from the above discount factor curve.
This project consists of the following files:
depoRates.txt
- contains a series of annualized cash deposit rates.futuresPrices.txt
- contains a series of prices of Eurodollar futures, which are futures on 3 month cash LIBOR deposits.tradeDate.txt
- contains the date at which the rates/prices are being observed, given as character strings in the formYYYY-MM-DD
.holidayCalendar.txt
- contains the dates of Federal Reserve holidays, given as character strings in the formYYYY-MM-DD
, for the next five years (available from, among other places, the Federal Reserve website).
USDYieldCurve.py
- contains class to create USD yield curve object and compute discound factor and forward rate.USDYieldCurveDate.py
- contains class to compute all USD yeild curve related dates, e.g., modified following date, spot date.main.py
- contains the testing program.YCtestcase.xlsm
- contains the testing case data.
This project cound imprt into Python3 environment and run via the commends
import USDYieldCurve
usdCurve = USDYieldCurve("depoRates.txt", "futuresPrices.txt", "tradeDate.txt", "holidayCalendar.txt")
print(usdCurve.getDfToDate(d1)) # d1 is a string in YYYY-MM-DD format
print usdCurve.getFwdRate(d2, d3) # inputs are in YYYY-MM-DD firnat