讲解4CMP辅导C/C++编程
- 首页 >> Java编程Project 2, 4CMP Spring Term 2019/20
PROJECT 2
4CMP, SPRING TERM, PART 2: PROGRAMMING IN C++
Lecturer: Dr Fabian Spill ()
Due Date: Sunday 5th April 2020 at 11.59 pm
Weighting: This project counts 40% to your final mark for the spring part of 4CMP.
INSTRUCTIONS FOR THE SUBMISSION:
Submit your code and accompanying document by the deadline on Canvas. Source code files that
are named as follows: The program should contain a main.cpp. additional files should be logically
named, e.g. Person_P1.h and Person_P1.cpp. Submit all individual source files, and a zip file
containing all source files.
This file should compile without errors or warnings on Visual Studio 2017 as installed on the clusters
in the learning centre, and the executable should run without problems.
Marking: The most important criteria for marking is the correctness of the code and the quality of
the submitted document. The code needs to compile and run correctly, and do what you were asked
to do. Style, efficiency, readability and formatting are also part of the evaluation criteria. In
particular, if the code is so unreadable that one cannot evaluate if it is working correctly, then you
risk losing many marks for that. Also, you should implement the code in an object-oriented way as
discussed in the lectures.
PROJECT 2: NUMERICAL OPTION PRICING PROGRAM
Write a program that can price European options, American options, Asian (European) Options with
different methods: Analytically, with a Binomial Tree, with a PDE and with Monte Carlo. Implement
puts and calls for each case.
Asian options are arithmetically sampled once per day and can only be exercised at the expiry date.
American options can be exercised every day, assuming 365 trading days per year.
Hence the payoff of an Asian call is
max(
1
∑()
=1
− , 0)
where the sum is over every evaluation day t, up to expiry T. K is, as usual, the strike.
Note that some methods are harder to implement for some derivatives than others. Some methods
may also not work for some options, or they only work approximately. Other options may be very
inefficient. Also, there are different methods to e.g. solve a PDE numerically, or to implement Monte
Carlo simulations. It is expected that every student will pass this project if only 2 methods are
implemented for Asian and American options, respectively (provided that the code is submitted with
a good style, and the submitted documents is of sufficiently high quality). For Europeans, you have
to implement all methods (but we already implemented most of them in previous lectures or
problem sheets). For achieve high marks, implement as many methods as efficiently as you can.
Submit a document that explains which methods you implemented for pricing the different options,
and why you picked that method (here you can go a bit more into detail. For example, say which
method you used to solve the PDE). Explain which methods are better for the different option types,
and why they are better. Analyse the error and the performance for calculating option prices with
the different methods. Explain the sources of your errors (e.g. is the error due to discretisation, or
due to an analytic approximation?).
The program and document should also contain the results and analysis for the following test cases:
SPECIFIC TESTS:
Consider the following data:
Constant continuously compounded interest rate = 0.04
Strike = 100
Constant volatility = 0.4
Expiries = 1, 2, 3 and 4 years
Calculate and plot the option prices as a function of initial share prices, ranging from (close to) 0 to
200 for the different expiries as above. Produce 8 plots for the different expires and for put and call
options, respectively. In each plot, show 4 graphs: European, American and Asian options, and the
appropriately discounted payoff (e.g. max(S-K exp(-rT),0) for calls, max(K exp(-rT) -S ,0) for puts).
Compare the different options and interpret your results (e.g. explain why some options are more
expensive than others, and why this may depend on the share price). Is put-call parity given for the
different option types?
For each type of option, you can calculate the prices with a default method of your choice. This
should be the one that you argued before to be the best for that option type.