Description
Mid-Term Programming Assignment: Portfolio
Optimization Software in C++ under Parallel Shifts in
Term Structure
1. If you worked with someone on a specific problem, make sure you
tell me about it. If you do not do this and I notice a verbatim
reproduction of material, I consider it as plagiarism. There can
be serious consequences to this.
(a) I will randomly pick ≈ 6 students in the class, who will be asked
to explain all aspects of their submitted code to me. Do not be
disturbed if your name appears in this list – I just need to go through
it to ensure the grading is fair.
2. If you picked-up the solution from some source, make sure you
mention it. If you do not do this and I notice a verbatim reproduction of material, I consider it as plagiarism. There can be
serious consequences to this.
3. Each submitted document should be personalized. I expect to
see
(a) C++ code and header files (if any), the comments in the
code should pretty much tell me what you are trying to do
(b) A PDF version of sample-runs that accompanies each submission, have to be uploaded on Compass by the due date.
4. The written In-Class Exam will be held during class hours on
17 October 2018.
1
I want you to write a comprehensive, readable (i.e. put a lot of comments;
have meaningful variable names; etc. etc.) Portfolio Optimization Software
Package in C++ assuming you have parallel shifts in the term structure.
Input Specification: The input file to your software will have the following
format:
1st-line: #CFs
2nd-line: CF-1’s PV Maturity cf 1
1
cf 1
2
cf 1
3
cf 1
4
· · · cf 1
n1
3rd-line: CF-2’s PV Maturity cf 2
1
cf 2
2
cf 2
3
cf 2
4
· · · · · · cf 2
n2
4th-line: CF-3’s PV Maturity cf 2
1
cf 2
2
cf 2
3
· · · cf 2
n3
· · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
kth-line: CF-k’s PV Maturity cf k
1
cf k
2
cf k
3
· · · · · · · · · · · · cf k
nk
(k + 1)th-line: FV of user’s due
debt obligation date
(i.e. k-many Bonds; the 1st number in each row is the PV of the bond, followed
by the bond’s cash-flows; not all of them have the same maturity; followed by
the FV of user’s debt obligation and the time when its is due).
Output Specification 1: We do not assume a flat term structure, but we
assume the term structure changes are parallel (i.e. the yield changes by the
same %-age amount for all maturities).
1. Compute the YTM for each cash flow.
2. Compute the duration for each cash flow.
3. Compute the convexity for each cash flow.
Output Specification 2 Assuming no changes in term structure, compute
the %-age of the face value of each cash flow you would have to purchase to
meet the future debt obligation.
Output Specification 3: Pick the bond-portfolio that will meet this obligation when it is due, and has the largest convexity among all possible portfolio
choices. You should pose this as a Linear Programming Problem and use lp solve
to find the optimal answer. Your final answer will say that we need to buy λ1%
of first cash flow, λ2% of second cash flow, λ3% of third cash flow, etc. No
short-selling is permitted (i.e. all your λ’s have to be non-negative).
1. In your write-up, present an explanation of the strategy/method that you
used in picking the best portfolio.
2. Make sure your program will handle the case when there is no portfolio that will meet the debt obligation if we are worried about (parallel)
movements in the term structure (cf. figure 2).
I also want to see a couple of sample runs (cook-up your own data; or use lesson
4 of my notes).
Partial Credit Information: This should help you decide how your efforts
should be spent in the next two weeks.
2
1. (20 points) Making sure you catch every possible error/infeasibility that
might occur in the general setting.
2. (20 points) Soundness of your theoretical arguments for the design-methodology
that you adopt for the portfolio design.
3. (60 points) The correct functioning of your code.
A sample screen shot is shown in figure 1.
3
Figure 1: A sample screen shot.
4
Figure 2: A sample screen shot of an infeasible set of cashflows.
5
Figure 3: A sample screen shot for the example that is done in lesson 4. You
can compare these results with those in the Brute-Force Excel Spreadsheets
provided on Compass with Lesson 4.
6