Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

MTH116

FINANCIAL AND ACTUARIAL MATHEMATICS

2st SEMESTER 2021/22 FINAL EXAMINATION

Foundations of Financial Computing

Project 1

In this project, we provide 251 days historical data of three stocks: AAPL, GOOG and TSLA. Please load the stock prices of three companies into     Matlab. Then use Matlab to complete the following questions.

1) Determine how many days the open price of TSLA was above 5 times of the open price of AAPL in the period.

2) Determine how many days the open price of TSLA was above both 5 times of the open price ofAAPL and 20% of the open price of GOOG in the period.

3) Determine how many days the open price of TSLA was above either

5 times of the open price ofAAPL or 20% of the open price of GOOG in the period.

4) Determine how many days the open price of TSLA was above either

5 times of the open price of AAPL or 20% of the open price of GOOG, but not both, in the period.

5) Suppose you owned 600 shares TSLA stock at the start of the          period, and you bought 100 shares every day when the open price    was below $200 and sold 200 shares every day when the open price was above $600 and your holding shares are greater than or equal to

200. Determine how many shares you own at the end of the period .

After you have understood/attempted the above problems, go to LMO to attempt the online questions (Questions 1-5).

25


Project 2

Please generate a special 10 by 10 square matrix that has ones in the first  row and first column, and whose remaining elements are generated in the following way . If the sum of the element above and the element to the left is less than 40 , this element is equal to the sum . Otherwise, the element is equal to the element to the left minus the element above .

1) Use the for loop and if structure to write a user-defined function to generate this special matrix .

2) Determine how many positive elements, zeros, and negative elements are contained in this special matrix, if any .

25

After you have understood/attempted the above problems, go to LMO to attempt the online questions (Questions 6-10).


Project 3

Suppose that X and Y follow a bivariate normal distribution with the joint probability density function (PDF) expressed as:

f x, y = 2几 exp [x+ − 2pxy + y+],

where p ∈ (−1,1) is the correlation coefficient .

1) Create an anonymous function of x, y and p that computes the joint PDF .

2). Use integral2 to estimate the joint probability P(0 ≤ X ≤ 1.5, 0 ≤ Y 2.5) for p = -0.5.

3) Plot the surface of f x, y , as well as the contour lines and the gradient 7f over the region

x, y | − 5 ≤ x ≤ 5, −5 ≤ y ≤ 5 .

After you have understood/attempted the above problems, go to LMO to attempt the online questions (Questions 11-15).

25


Project 4

AAPL_LogReturn.mat contains the stock return (%) of Apple. Assume that the return could be expressed by an AR(2) process given by:

r? = a + b rB?CB + b+r?C+ + e?

where r? is the stock return at day t, ?CB(r) and r?C+ are returns 1 and 2 days prior to day t, e? is the error following a standard normal distribution.

1) Given the length of the return array is 250, compute the 248×3 array of [r? , ?CB(r) , r?C+].

2) Use the regress function to find the estimated values of a, bB and b+ . 3) Suppose that the estimated parameters are denoted as a, bB and b+ , the regression error is given by:

25

eOt = t a + bB tCB + b 2tC2 .

Compute the mean and standard deviation of eOt . And produce the QQ- plot against a normal distribution with the same mean and standard              deviation.

After you have understood/attempted the above problems, go to LMO to attempt the online questions (Questions 16-20).