BEST代写-线上编程学术专家

Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

C++代写 | MATH5350M: Computations in Finance

C++代写 | MATH5350M: Computations in Finance

这个作业是用C++完成投资风险评估

MATH5350M: Computations in Finance (Year 2019/20) Jitse Niesen
Coursework 1 (30%): Due 24 February
Implement a function responsible for inputting data. This function should be informative,
user friendly and must verify correctness of arguments. You are expected to deal with
situations when an inputted parameter is clearly wrong: for example, S0 ≤ 0. Don’t try
to deal with situations when a user inputs a letter when a number is needed. The header
of the function is given below
void input_data(double& S_0, double& r, double& sigma,
double& T, double& K, int& n);
The meaning of parameters is as follows:
• S_0 – initial price of the stock, i.e. S0,
• r – risk-free interest rate (per annum),
• sigma – the volatility of the stock price σ (per annum),
• T – expiry time of the option that expires last,
• K – strike price K of the American put option,
• n – number of periods in the binomial tree (M in the slides).
Part 2. The approximate CRR method (20 marks)
Implement the pricing of the American put option on a recombining binomial tree. Use the
approximate CRR method for the calibration of the binomial model. The computed price
should be returned by the function. The header of the function that you will implement is
provided in the file CW1-student.cc and below for your convenience:
double compute_price_approx_CRR(double S_0, double r, double sigma,
double T, double K, int n);
The parameters have the same meaning as in Part 1. This function should be standalone
(ready to use in other programmes without your function input data), so it must perform
its own verification of parameters. It does not mean that you are relieved from checking
correctness of parameters in the function input data! The above function must not communicate
with a user or print anything on the screen. The only way to inform about errors
is to call function error(…).
2
MATH5350M: Computations in Finance (Year 2019/20) Jitse Niesen
Part 3. Verification (15 marks)
An important (and difficult) part of computations in finance is verification: How can you
be sure that you can rely on your program? Imagine that you are planning to do some big
trades based on the results of your program.
Verify (as well as you can) that your program produces correct prices. Think about whether
there are parameter values when you know the result, perhaps only approximately or in
certain limits. Document your verification process so that your hypothetical manager may
be sure that she can rely on your code. Your documentation must be concise (don’t produce
20 screenshots) but detailed enough to give your manager confidence.
Part 4. Results (15 marks)
Compute the price of a 10-month American put option with strike price 45 when the
underlying stock price is 51, the risk-free interest rate is 4% per annum and the volatility
is 30% per annum. Use a binomial tree with 100 periods.
Make a plot showing how the computed price varies as you change the number of periods,
similar to page 45 of the slides of Lecture 1. Based on your results, what is the price of
the option? Give a rough estimate of the accuracy of your answer and explain how you
arrived at it.
Part 5. Centring the tree (15 marks)
As discussed during the lectures, we can slightly modify the tree so that the strike price
is always in the middle of the tree to eliminate the oscillations in the plot. Implement
a function compute_price_centred_tree with the same arguments as the function
compute_price_approx_CRR in Part 2. This function should compute the price of an
American put option using a centred binomial tree. Plot the price computed using this
function, similar to page 47 of the slides.
Part 6. Richardson extrapolation (20 marks)
Show that the prices computed in the previous part satisfy P(M) ≈ P +AM−1
for large M,
where P(M) denotes the price computed a binomial tree with M periods, P is the true
price, and A is a constant. This suggests the use of Richardson extrapolation.
Implement a function compute_price_extrapolation with the same arguments as in
Part 2 and 5 which computes the price of an American put option using Richardson extrapolation.
Plot the price computed using this function, similar to page 50 of the slides.
Based on your results, what is the price of the option? Give a rough estimate of the
accuracy of your answer and explain how you arrived at it.
3
MATH5350M: Computations in Finance (Year 2019/20) Jitse Niesen
Directions for submission
You need to submit a report and the code.
Report: Your report must be typed in Microsoft Word or Latex. Hand-written reports
or reports containing photos of hand-written notes will not be accepted. Do not include
the code in your report. Structure your report as the assignment (Part 3, Part 4, Part 5,
Part 6), leaving out Part 1 and Part 2 which do not require an answer.
Your report (as a pdf file) must be uploaded in the Submit My Work area using the
TurnitIn submission tool entitled “Report submission for Coursework 1”.
Code: Before submission, clean up the code, make sure that comments in the programme
make following the code easy, check that the programme compiles. Make sure you have
not shared your code or a piece of thereof with anyone else as this qualifies as plagiarism.
The C++ file CW1-student.cc (NO pdf, doc, ps, etc.) must be uploaded in the Submit
My Work area using the assignment submission tool entitled “CW1-student.cc submission
for Coursework 1”

bestdaixie