Computational Finance Project
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
Compute European Put Option Prices with Finite Difference Method
Computational Finance Project (30% of total module marks)
18-12-2022
PrOjeCt marks range 0 tO 30.
1. Background
Let us consider a European Put option.
Recall that the buyer of a put option has the right to sell stock at time T for the exercise price K (the terminology“strike price K”is also used with the same meaning of“exercise price K”). Assume the stock price S paying a continuous dividend yield q follows the process below:
where r is the risk-free interest rate and W is a Wiener process under the risk-neutral probability measure.
We know that the price of the option, V (S, t), on the above stock satisfies the Black-Scholes equation below:
The payoff of the option at time T is
V(S, T) = max{K – S, 0}
With a change of time variable τ = T − t the equation satisfied by the option becomes
and the payoff of the option becomes the initial condition
(1)
Let the minimum and maximum stock prices be Smin = 0 and Smax much bigger than the strike price (we will use Smax = 4 K) . The boundary condition is (European put option)
(2)
The project aims to investigate the properties of the numerical solution of the BS equation as follows:
(a) Reduce the BS equation to the heat equation
(b) Solve the HE using a Finite Difference Method (FDM) scheme of your choice; namely the
explicit, the implicit, or the Crank-Nicholson scheme
(c) Use (a) and (b) to solve the BS equation numerically.
2. Project Tasks (max total of 30 marks)
You are asked to implement the following programming tasks (1-5) and to write PDF documentation (task 6).
1. (4 marks) Consider the following domain: x interval [a,b], t interval [0,T]. Generate the grid in the x, t coordinates as follows:
• Space interval divided into N equal parts (N+1 boundary points). The index values should be consistent with MATLAB array index convention running from 1 to N+1.
• Time interval divided into M equal parts (M+1 boundary points). The index values should be consistent with MATLAB array index convention running from 1 to M+1.
2. (4 marks) Using the change of variables described in the lectures (going from the unknown function V(S,t) to the unknown function v(x, τ) and then to the unknown function u(x, τ)), convert the BS equation to the heat equation
Use the values Smin = 0.001, Smax = 4 K . Write the MATLAB code to generate the x interval and the τ interval (from the values of Smin , Smax and T calculate the range of the x variable and the τ variable). Note that the change of variables is
and that the above time variable is different by a factor from the time variable used in the Background section (where we used the change of time variable τ = T – t ).
Calculate the corresponding grid.
3. (4 marks) Translate the initial and boundary conditions (1) and (2) in the correct initial and boundary conditions for the new unknown function u(x, τ).
4. (4 marks) Use a scheme of your choice (Implicit, Explicit, or Crank-Nicholson) to solve the heat equation for u(x, τ). In the case of the explicit finite difference scheme, demonstrate that the scheme is conditionally stable and find the condition under which the scheme would be stable.
5. (8 marks) Work your way back from u(x, τ) to V(S,t). to solve the Black-Sholes equation.
MATLAB code to solve the Black-Scholes equation in the conditions described in this project, using a direct derivation of a finite difference scheme (with non-constant coefficients) is given as file “ImplicitFDMBSEurPricePut.m” . You can use this script to check the validity of your results by comparing the curve V(S, t = 0) calculated by your code with the same curve (represented by the value of the variable “Vold” at the end of the execution of “ImplicitFDMBSEurPricePut.m”).
6. (6 marks) The code should be accompanied by detailed documentation, split into:
• MATLAB comments explaining the structure of the code, available functions, main variables and any other information to help to understand the code;
• developer documentation (as a PDF document) summarizing the structure of the code, available functions, main variables and any other information to help to understand the code, including directions on how to extend the code to handle more general features; also report some test runs of your code;
• end-user’s instructions (as a second PDF document) explaining how to use the script(s), how to input data and how the results are presented, and a brief description of the methods implemented. Also, the discussions of (a), (b) and (c) should be included here.
The marks for tasks 1 to 5 will be based on coding style, clarity and accuracy of computation.
This project wiII contribute 30% towards the finaI mark for the moduIe. Submit yOur wOrk by uplOading it in MoodIe by 23:55 on the 22nd of January. Submit the COde as a single COmpressed .zip file, inCluding all MATLAB ( .m) files and the PFD files (twO separate .pdf files COntaining deVelOper dOCumentatiOn and user instruCtiOns), all residing in a single parent direCtOry, whOse name shouId contain your name and student code.
The project will be marked anonymously. Please do not write any information that could be used to reveal your identity in the code or in the PDF documents, or in filenames (except the .zip filename).
It may prove impossible to examine projects that cannot be unzipped and opened and run on a standard computer directly from the directories created by unzipping the submitted .zip files. In such cases a mark of 0 will be recorded. It is therefore essential that all project files and the directory structure are tested thoroughly on computer lab machines before being submitted in Moodle. It is advisable to run all such tests starting from the .zip files about to be submitted and using a different computer to that on which the files have been created.
A common error is to place some files on a network drive rather than in the submitted directory. Please bear in mind that testing on a lab computer may not catch the error if the machine has access to the network drive. However, themarkers would have no access to the file (since they have no access to your part of the network drive) and would be unable to compile the project. All files must be submitted inside the zipped project directory and connected to the project. Please check before submitting!
2023-01-20
Compute European Put Option Prices with Finite Difference Method