程序代写代做代考 c++ finance scheme algorithm (Coursework 3) MATH 5350MThis question paper

(Coursework 3) MATH 5350MThis question paper
consists of 4 printed pages,
each of which is identified
by the Code Number MATH 5350M

c©UNIVERSITY OF LEEDS
(Semester 2, 2016/2017)

Assessed Coursework 3

MATH 5350M Computations in Finance

(35% of the total coursework mark)

Submission deadline: 12 noon on Tuesday, 2nd May 2017

You must use templates (files CW3-main.cc, CW3-student.cc) provided in the Assessed Assignment Sub-
missions area within the module resource on the VLE. File CW3-main.cc must not be changed. 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.

Pricing a smooth butterfly option

Throughout this coursework, the market model is that of Black-Scholes, i.e., there is one bond, priced at
Bt = e

rt, and one stock, whose price process, under the risk neutral measure, satisfies

dSt = rStdt+ σStdW̃t,

where W̃t is a Brownian motion, r is an interest rate and σ is a volatility.

In this coursework, you will design, implement and analyse PDE pricing of a smooth butterfly, i.e., an option
with the payoff at time T equal to (

1−
4(ST −K)2

w2

)+
,

where K is the strike price and w is the width of the payoff.

Important! All functions (apart from input data) should be standalone (ready to use in other programmes)
and must perform their own verification of parameters. They must not communicate with a user or print
anything on the screen. The only way to inform about errors is to use exceptions (a call to a function
error(…) throws an exception for you).

Part 1. Inputting data (5 marks)
Implement the following function using a template given in the file CW3-student.cc:

void input_data (double& r, double& sigma, double& T, double& K, double& w,

int& grid_s, int& grid_t, double& max_x, double& S0);

The data:

• r – risk-free interest rate (per annum),

• sigma – volatility of the stock σ (per annum),

Page 1 of 4

(Coursework 3) MATH 5350M

• T – exercise time,

• K – strike price,

• w – width of the butterfly,

• grid s – number of grid intervals in the space variable (M on slides),

• grid t – number of grid intervals in the time variable (N on slides),

• max x – determines the following values in the numerical scheme presented during lectures,

xmin = −max x, xmax = max x,

• S0 – the initial stock price for which we want to do the analysis.

This function will not be marked and you should implement it in the way which is the most convenient for
you.

Part 2. Preparations (10 marks)
In order to price the smooth butterfly option using PDE methods, you need to add boundary and terminal
conditions to the following Black-Scholes PDE:

1

2
σ2s2

∂2V (s, t)

∂s2
+ rs

∂V (s, t)

∂s
− rV (s, t) +

∂V (s, t)

∂t
= 0.

Provide in the report those conditions and their justification.
Using notes from lectures, transform the PDE into the heat equation with appropriate initial and bound-
ary conditions. Reproduce this heat equation with boundary conditions in your report, but do not attach
derivations and justifications.

Part 3. Numerical solution of the Black-Scholes PDE (40 marks)
Implement the following function using the template given in the file CW3-student.cc:

void compute_PDE_option_price (vector& prices, double r, double sigma,

double T, double K, double w, int grid_s, int grid_t, double max_x);

Function compute PDE option price solves the heat equation derived in Part 2 using the Implicit Scheme.
The result of computation is stored in the vector prices that is supposed to hold grid s+1 numbers. Make
sure you resize the vector appropriately before you attempt to fill it with numbers..

Vector prices stores approximations to

y(xi,
1

2
σ2T ), i = 0, 1, 2, . . . , grid s,

where
xi = −max x+ i

2 max x

grid s
.

For testing of the implementation of the scheme you can use a vanilla call option (remember to adjust
boundary and terminal conditions) and compare the results with the Black-Scholes formula for the price.
Do not include testing in your submission but nevertheless perform it since errors in your program will affect
your mark.

Page 2 of 4

(Coursework 3) MATH 5350M

Part 4. Choosing parameters of the numerical algorithm (20 marks)
Price a smooth European butterfly option for the following parameters:

r = 0.05, σ = 0.3, T = 0.5, K = 2.5, w = 0.3, S0 = 2.

Your goal is to choose max x, grid s, grid t to obtain an accurate price. Justify your choice using numerical
results. Answer to this question including graphs and tables must fit into one A4 page written in 11pt font
(this font restriction does not apply to graphs); it may also be shorter.

Part 5. Free boundary problem for an American smooth butterfly option (10 marks)
Write down a free-boundary problem for the price of an American option with the smooth butterfly payoff.
Reproduce then a transformed free-boundary problem for the heat equation. Do not include any derivations.

Part 6. Implementation of pricing of the American smooth butterfly (15 marks)
Implement the solution of the above transformed free-boundary problem using the explicit scheme.
The marking for this part will be binary: you get the full mark if the results are correct and zero marks if
there are errors. Perform a very careful testing of your programme including parameter checking.

Hints:

• Presentation will be marked. Be concise and choose carefully how you present results of your com-
putations.

• Structure your document in the same order as in this paper: Part 1, Part 2, Part 3, … (do not include
C++ code). Skip those parts that involve coding only.

Directions for submission

Report: Your report must be typed in Microsoft Word or Latex using an 11pt font with single (normal) line
spacing. Hand-written reports or reports containing photos of hand-written notes will not be accepted. Do
not include any code in your report. Your report (doc, docx or pdf file) must be uploaded in the Assessed
Assignment Submission area using the TurnitIn submission tool entitled ”Report submission for ACW 3”

Code: The file CW3-student.cc (NO pdf, doc, ps, etc.) must be upoaded in the Assessed Assignment
Submission area using the assignment submission tool entitled ”CW3-student.cc submission for ACW
3”

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.

Marking: The following aspects of your programme are important in the marking: correctness (the pro-
gramme does what it is supposed to do), quality of code (e.g. meaningful names for variables, fool-
proofness for input data), comments (whether they facilitate understanding of the code) and efficiency
(speed and memory usage).

An electronic copy of the assignment must be submitted to the Assignment Submission area within the module resource
on the Blackboard VLE website no later than 12 noon on the deadline date. Faxed, emailed or hard copies of the

Page 3 of 4

(Coursework 3) MATH 5350M

assignment will not be accepted. Failure to meet this initial deadline will result in a reduction of marks, details of which
can be found at the following place: https://lubswww.leeds.ac.uk/TSG/coursework/
SUBMISSION
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 click
the ‘CONFIRM’ button before 12 noon for your assignment to be classed as submitted on time, if not you will need to
submit to the Late Area and your assignment will be marked as late. It is your responsibility to ensure you upload the
correct file to the VLE, and that it has uploaded successfully. It is important that the submission of your report follows
the conventions stated below:
FILE NAME
The name of the report file that you upload must be your student ID only.
ASSIGNMENT TITLE
During the submission process the system will ask you to enter the title of your submission. This should also be your
student ID only.
FRONT COVER
The first page of your report should always be the Assessed Coursework Coversheet (individual), which is available to
download from the following location https://lubswww.leeds.ac.uk/code-of-practice/downloadable-forms/
STUDENT NAME
You should NOT include your name anywhere on your assignment

END

Page 4 of 4

https://lubswww.leeds.ac.uk/TSG/coursework/
https://lubswww.leeds.ac.uk/code-of-practice/downloadable-forms/