联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2020-02-23 07:46

Problem Sheet 3, 4CMP Spring Term 2019/20

PROBLEM SHEET 3

4CMP, SPRING TERM, PART 2: PROGRAMMING IN C++

Due Date: Saturday 22nd February 2020 at 11.59 pm

Weighting: This problem sheet counts 15% to your final mark for the spring part of 4CMP, but only

the best two out of problem sheets 1-3 count.

INSTRUCTIONS FOR THE SUBMISSION:

Submit your code by the deadline on Canvas. Each problem on this sheet should be implemented in

source code files that are named as follows: Each program contains a main_X.cpp. Here, X is the

number of the problem. For example, main_P1.cpp. Likewise, additional files should be tagged with

the problem number. For instance, if you would add a class Person in Problem 1, implement the

code in two files labelled: Person_P1.h and Person_P1.cpp.

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. It needs to compile

and run correctly, and do what you were asked to do. However, 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.

PROBLEM 1: EUROPEAN OPTION PRICING WITH THE BIONOMIAL TREE

Write code to price European Put and Call Options with the binomial tree.

Create the following options in main, and compare the price obtained with a tree with 25 time steps

and the analogous result obtained by the Black Scholes formula:

Time to Expiry: 1

Volatility: 0.4

Continuously compounded risk free interest rate: 4%

Current Share Price: 100

Three strikes: 90, 100 and 110

Price Puts and Calls with the three strikes above

Next, perform a convergence study: Vary the time step in the tree over a reasonable interval and

investigate how the option price change with the time step. Compare with the Black-Scholes result.

What do you see? Describe your finding in a pdf document that you submit together with the code.

It might help to include a figure (e.g. price as a function of time step).

Instructions: The code should be as object-oriented as possible. Use classes to represent options and

also to represent the tree. The actual calculation of the option price with the tree is quite easy. If

classes are still difficult for you, start without classes and first just try to get the price right.

Comparing with the Black-Scholes formula should help you to see if you obtained the correct result.

We assume that the tree is constructed according to Cox, Ross and Rubinstein (CCR).

PROBLEM 2: MATRIX OPERATIONS

Write code to represent matrices and perform basic operations on double-valued matrices. This

should include:

- Basic arithmetic operations (addition, subtraction, matrix multiplication)

- Matrix transposition

- Printing the matrix elements to the command line

You are allowed to use functionality that we discussed (e.g. vectors) but should otherwise not use

external libraries that already represent matrices. Write the code in an object oriented way. You may

want to implement useful helper functions, such as functions to set or get elements of the matrix.

You may want to overload the operators +, - and * to implement matrix addition, subtraction and

multiplication. However, if that is too difficult, start by simply implementing functions that perform

addition, subtraction and matrix multiplication.

Make sure all operations implement appropriate checks for the size of the matrices.


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp