首页 > > 详细

辅导FRE6831、讲解Risk Engineering、Python语言辅导、讲解Python讲解留学生Prolog|调试Matlab程

FRE6831
COMPUTATIONAL FINANCE LABORATORY (PYTHON)
Dept. of Finance and Risk Engineering
Office Hours by appointment
PROJECT: IMPLEMENTING A LIBOR YIELD CURVE OBJECT
The class project is to write a Python program that infers the short end of the USD LIBOR yield curve
from market observations, via the methodology in use prior to 2008 (More modern methodologies are too
complex for an introductory course.). It is to support two calculations:
1. The “discount factor,” or present value of a US dollar for a given future date, up to 3 years after a
given “spot” date (See below for a definition of the spot date.).
2. 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 as explained below.
Because this calculation uses the above discount factor calculation, both of the input dates must
also be less than approximately 3 years after the spot date.
The yield curve is to be implemented as a Python class that I will import into my environment and run via
the commands
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
Inputs
Typical inputs to such a calculation – and the inputs to assume here – are to be read from the four text
files named above.
1. depoRates.txt contains a series of annualized cash deposit rates. These cash deposits are
effectively jumbo versions of the certificates of deposit that are on offer at any bank. These
deposits should be read from a text file, each line of which has the following format:
<5 character instrument code> white space
The instrument code will always have the prefix “USD” and the suffix “D”, “W”, or “M”, which
will indicate whether the deposit is for a period of days, weeks or months. In between this prefix
and suffix will be a number, indicating the number of days, weeks, or months to maturity. For
example, “USD1W” would be the code for the cash deposit maturing in one week; “USD2M”
would be the cash deposit maturing in 2 months, etc. The start date of these cash deposits is
always assumed to be the “spot date” (More about the “spot date” later.).
The first few lines of such a file might read
USD1D 2.73
USD1W 2.74
USD1M 2.75
USD3M 2.80
USD6M 2.85
You can assume that the number in the above codes is only a single digit (Although 12 month
LIBOR deposits do exist, they are seldom used to construct yield curves.). Some of the above
tenors may be omitted; in fact, the only one that is really necessary is USD6M (Why?).
2. futuresPrices.txt contains a series of prices of Eurodollar futures, which are futures on 3
month cash LIBOR deposits. You can assume that the futures on successive lines of the file
mature on successively later dates. Each line of the file has the following format:
<4 character instrument code>

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!