MATH5350M: Computations in Finance (Year 2019/20) Jitse Niesen
Coursework 2 (50%): Due 4 May Pricing of options under stochastic interest rates
Your work should be submitted on MINERVA before 14:00 on Monday 4 May. Late coursework will be marked down.
You must use templates (files CW2-main.cc and CW2-student.cc) provided in the Assessed Assignment Submissions area within the module resource on MINERVA. You may change CW2-main.cc, but the CW2-student.cc that you submit must work with the CW2-main.cc file originally provided. Make sure you do not share your code or a piece of thereof with anyone else as this qualifies as plagiarism for both of you.
Further details on how to submit are given at the end.
Consider a model with two assets: a riskless money-market account with the price pro- cess Bt and a risky stock with the price process St. Their dynamics follow
ttttt where the short rate rt evolves according to
dBt = rtBt dt,
dS =Sr dt+SσdW(1),
dr =κ(0.05−r)dt+β√rρdW(1) +1−ρ2dW(2). ttttt
Above, W (1) and W (2) are two independent Wiener processes and ρ ∈ [−1, 1] is the corre- lation coefficient (it is responsible for modelling dependence between random moves of the interest rate and the stock).
Your task is to design and implement a Monte Carlo algorithm for pricing of the following exotic call option: if the lower barrier B is reached the holder of the option has to pay 1 at the first time of reaching the barrier, otherwise he receives the call option payoff (ST −K)+ at time T. In mathematical terms, denoting by τ = inf{t ≥ 0 : St ≤ B} , the payoff is
−1, at time τ if τ ≤ T, (ST−K)+, attimeTifτ>T.
Whenever you can, compute solutions to stochastic differential equations exactly. Other- wise, apply the Euler–Maruyama scheme.
1
MATH5350M: Computations in Finance (Year 2019/20) Jitse Niesen
Part 1. Inputting data (10 marks)
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& sigma, double& rho, double& r_0,
double& beta, double& kappa, double& K, double& B,
double& T, int& m, int& n);
The meaning of parameters is as follows:
S_0 – initial price of the stock, i.e. S0,
sigma – volatility component of the stock σ,
rho – the correlation coefficient ρ,
r_0 – initial value of the interest rate (per annum), i.e. r0, beta – the volatility component of the interest rate β,
kappa – the mean-reversion speed κ,
K – the exercise price K,
B–thebarrierB>S0,
T – exercise time in years,
m – number of Monte Carlo iterations,
n – number of steps of the numerical scheme to solve SDEs.
Hint: realistic values for the interest rate parameters are β ∈ (0.08, 0.2) and κ ∈ (0.3, 1).
2
MATH5350M: Computations in Finance (Year 2019/20) Jitse Niesen
Part 2. Algorithm for vanilla call option (10 marks)
For simplicity, we start with prizing a vanilla European call option in the stochastic interest rate model. Later we will tackle the exotic option.
Write an algorithm for valuation of a vanilla European call option in the model described on the first page using a simple Monte Carlo algorithm. The presentation of your algorithm should be similar to the presentation of algorihtms in lectures and seminars. Explain formulas used, in particular for the solution of SDEs. There is no need to repeat the theory behind the Euler–Maruyama scheme.
Part 3. Algorithm for exotic call option (10 marks)
Write an algorithm for the valuation of the exotic call option described on page 1 using a simple Monte Carlo method. Explain the differences with the algorithm for the vanilla option.
Part 4. Implementation (40 marks)
Write C++ functions which implement the above algorithms. Use the templates given in the file CW2-student.cc:
void compute_vanilla_call_price(double& price, double& left, double& right,
double S_0, double sigma, double rho, double r_0, double beta,
double kappa, double K, double T, int m, int n);
void compute_exotic_call_price(double& price, double& left, double& right,
double S_0, double sigma, double rho, double r_0, double beta,
double kappa, double K, double B, double T, int m, int n);
These functions have three output parameters: price should contain the estimated price of the option and left and right should contain the end points of the 99% confidence interval for the price. If you have doubts about the exact meaning of the output variables, check how they are used in CW2-main.cc. The other parameters have the same meaning as in Part 1.
These functions should be standalone (ready to use in other programmes without your function input data), so they must perform their own verification of parameters. The functions must not communicate with a user or print anything on the screen. The only way to inform about errors is to call function error(…).
3
MATH5350M: Computations in Finance (Year 2019/20) Jitse Niesen
Part 5. Analysis (40 marks)
Compute the price of the exotic call option with the following parameters:
S0=100, K=100, σ=0.3, T=1, B=90, ρ=0.4, r0=0.1, β=0.2, κ=0.3.
Comment on how you picked m and n.
Explore the dependence of the price on the barrier B and, separately, on the correlation ρ.
Provide explanations for the observed behaviour.
Present your analysis in the report. Think how to present it in a compact and clear way. Suggested length: one or two pages, including any graphs and tables (whichever you find required). The correctness, depth and presentation of your analysis will be the basis for marking.
4
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 and include your student number. 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 2, Part 3, Part 5), leaving out Part 1 and Part 4 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 2”.
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 CW2-student.cc (NO pdf, doc, ps, etc.) must be uploaded in the Submit My Work area using the assignment submission tool entitled “CW2-student.cc submission for Coursework 2”
Marking criteria: The following aspects of your report are important in the marking: quality of the answers, presentation (easy to understand, looking professional), relevance, conciseness (you can do good work in two pages, five is excessive).
The following aspects of your programme are important in the marking: correctness (the programme does what it is supposed to do), quality of code (e.g. meaningful names for variables, comments that facilitate understanding of the code) and efficiency (speed and memory usage).
Deadline: Both the report and the code have to be submitted by the deadline. Please ensure that you leave sufficient time to complete the online submission process, as upload times can vary. Accessing the submission link before the deadline does NOT constitute completion of submission. You must finish the whole submission process by the deadline. It is your responsibility to ensure you upload the correct file to MINERVA, and that it has uploaded successfully.
Anonymity: Do not include your name anywhere, not in your report, nor your code, nor your filenames. Only include your student ID. Your work will be marked anonymously, but this can only be done if your name does not appear in your submission.
5