Write a program that computes the theoretical value of a Canadian bank's multi-currency portfolio of financial instruments under various market scenarios. The command you will run to execute the program is as follows.
java PortfolioManager inputfileOutput will be written to stdout and will include (on separate lines) the current valuation of the portfolio, and its valuation under each of the input market scenarios expressed as an absolute change. All output numbers should be rounded to the nearest dollar, and aligned as shown.
mark-to-market: $143,456,345 IR down: -$345,325 IR up: +$112,345 ...
Portfolios contain other portfolios in a hierarchical structure. You will be valuing the root portfolio. Leaf portfolios contain a set of positions in such things as stocks, bonds, futures, and options. The same financial instrument may be held in more than one leaf portfolio (although the number of units held, the position size, may differ). It is likely that end-users will require the ability to dynamically load new types of financial instruments into the system (for instance, certificates of deposit, currency futures, swaps, caps and floors, and so on). New types of instruments will inherit attributes from selected existing ones, and add a new set of attributes of standard types.
According to user preference, financial instruments may be valued in in any number of ways. For example, an option may be valued using a Black-Scholes approach or a lattice-based approach. A bond may be valued using the SIA standard method or by zero curve pricing. A stock may be valued using a single-factor or a multi-factor method. It is likely that users will wish to add their own alternative methods for the valuation of financial instruments.
A valuation method may be applied to compute the value of one unit of a given financial instrument. By multiplying this value by the position size, converting to Canadian dollars, and aggregating up the portfolio hierarchy, a value for the top-level portfolio may be computed.
In general, financial instruments are valued using various types of market data. One example of market data is called a spot zero curve. It relates various terms of a loan (due dates into the future) to the interest rate to be paid. There is a different spot zero curve for each different currency. Another such entity is the current value of an equity index, such as as the TSE100. Yet another such entity is the current foreign exchange rate with respect to the Canadian dollar. Values for the current market data will be contained in the input file.
Scenarios on the market data (such as an x% move up or down) are input as well. The system must be able to compute the aggregate portfolio value under the current conditions (called the mark-to-market valuation) and under all alternative market scenarios (of which there might by hundreds of thousands generated off some type of statistical distribution).
Data will be supplied to your system via a standard ASCII, XML-formatted file whose name is supplied as the sole command-line parameter. The file will contain instrument definitions, a portfolio/position hierarchy, current market data, and scenario data. You system should be able to handle the following types of instruments, using the indicated market data.
Financial Instruments | |
Instrument | Model |
Zero Coupon Bond | Zero Curve Pricing |
Equity | Beta w.r.t. an index |
European Equity Call Option | Black-Scholes |
Currency Future | IR Parity |
Market Data | |||
name | axis | how many | units |
Spot Zero Interest Rate Curve | days to maturity | 1 per currency | continuously compounded interest rates |
Equity Index | none | 1 per currency | unit-less |
Exchange Rate | none | 1 per foreign currency | foreign/domestic |
Details for the various instrument attributes, valuation methods, and the file format may be found on the course Web page.
You will hand in a design document including UML, and Java code. You must show at least one example of each of a UML class diagram, object diagram, sequence diagram, and collaboration diagram. You will be expected to consciously apply many design patterns, and make explicit reference to them in your design documentation. You will be marked on the same basis as for assignment #1 (25% for a working program, 25% for the design , 25% use of patterns, 25% quality of design document and code). When done, you should use the CDF system's submit command as follows:
submit -N assignment2 csc407h file1.java file2.java ...The standard course lateness policy applies, and will be assessed based upon when the written work is handed in.
bonus
For an extra 5% absolute, implement multi-threaded scenario evaluation.
Take an argument '-t n' where n is the number of threads to work on
the scenarios concurrently. Hand in a graph plotting number of threads versus
performance for valuing a fixed number of scenarios. Explain the results.