代做BUSI 4624 – Programming for FinTech Coursework 2: Financial analysis with Python帮做Python编程

2024-12-11 代做BUSI 4624 – Programming for FinTech Coursework 2: Financial analysis with Python帮做Python编程

BUSI 4624 – Programming for FinTech

Coursework 2: Financial analysis with Python

Answer all questions below in .ipynb file.

In each question, 50 percent of the mark will be allocated to coding, and 50 percent of the mark will be allocated to the discussion (if asked in the question) and the script. explanation (for all questions, you are required to provide detailed explanation for each line of code in your script. to clearly illustrate the coding logics in solving the problems; the explanation should be specific and relevant to the question).

Submission deadline: 3pm 11th December 2024 via Turnitin.

Question 1 (5 marks)

Set the random seed to be your student number (e.g., 20123456) and use random.sample function to choose a random set of 5 different companies among the following list:

Apple Inc, Amazon.com Inc, Microsoft Corp, NVIDIA Corp, Ford Motor Co, Intel Corp, JPMorgan Chase & Co, General Electric Co, Walmart Inc, eBay Inc, Johnson & Johnson, Cisco Systems Inc, Exxon Mobil Corp, Bank of America Corp, Oracle Corp, Pfizer Inc, Tesla Inc, Broadcom Inc, Meta. Platforms Inc, Costco Wholesale Corp, Netflix Inc, PepsiCo Inc, Adobe Inc, QUALCOMM Inc, Texas Instruments Inc, Starbucks Corp, PayPal Holdings Inc, Electronic Arts Inc, Booking Holdings Inc, Comcast Corp, Honeywell International Inc, Amgen Inc, Intuit Inc, Synopsys Inc, CSX Corp, Advanced Micro Devices Inc, T-Mobile US Inc, Intuitive Surgical Inc, Applied Materials Inc, Vertex Pharmaceuticals Inc, Visa Inc, Procter & Gamble Company, Mastercard Incorporated, Home Depot Inc, Coca-Cola Company, Mcdonald's Corporation, Abbott Laboratories, Verizon Communications, Wells Fargo & Co, The Walt Disney Company.

Question 2 (15 marks)

Download the daily trading data from 01/01/2023 to 31/12/2023 for the selected stocks from https://twelvedata.com/ into separate pandas dataframes (one dataframe. per stock) with the following column names: date, open, high, low, close, volume. Use the stock ticker symbols (e.g., AAPL for Apple Inc.) as the names of the dataframes. The data should have observations of earlier dates at the top and later dates at the bottom.

When searching for the tickers of the companies in https://twelvedata.com/, note that all of these are common stocks of companies in United States.

Question 3 (70 marks)

Using the close price of the last stock among your selected stocks above, perform. the following tasks in python:

a. Calculate the daily returns of the stock in the last year. (5 marks)

b. Estimate a suitable model for the return process of the daily returns calculated in the previous question. The model should be able to capture common features of stock returns documented in the literature, including autocorrelation, volatility clustering. The parameter setting of the model should be chosen by comparing the Akaike Information Criterion (AIC) of various settings. Your script. should obtain the AICs of various settings and select the best one for the model, and report the estimation result of only the best model. Does the estimated return process exhibit common features of stock return in the literature?

(20 marks)

c. Using the estimated return process of the above question, calculate the expected daily volatility in the first trading day in January 2024 using the estimated volatility and error term of the last trading day of 2023. (5 marks)

d. Using https://www.marketdata.app/ , obtain information on December 29, 2023, about the put option with the strike price closest to the last closing price of the stock in your data, and with the expiration date of June 21, 2024. Please note that for stocks that have undergone stock-splitting during the January 2024 – June 2024 period, stock prices on twelvedata.com have been adjusted for the stock split, while those from marketdata.app have not. Using this strike price, and the estimated volatility above, calculate the Black-Scholes-Merton fair price of a 6-month put option. The current risk-free rate is 5.75% per annual. You can use the following formula to calculate the annualised volatility of a stock based on its daily volatility: Compare your estimated fair price with the trading prices of the option obtained above. (30 marks)

e. Develop a trading strategy that buys 1 share of the stock at the opening price of the next trading day when the daily return of a day is less than or equal to the 10th percentile of the distribution of daily returns over the previous trading 100 days (excluding the signal day). The strategy will exit the position when the daily return of a day is greater than or equal to the 90th percentile of the distribution of daily returns over the previous trading 100 days (excluding the signal day). The maximum long position is 1 share. You should only use the data you have downloaded and processed (i.e., please do not re-download and process data again). You do not need to back-test or examine the performance of the strategy. (10 marks)

Question 4 (10 marks)

For the 4 other stocks selected in Question 1, using their close prices over time to obtain their expected daily return and covariance matrix (using sample average and covariance) and plot the efficient frontier of a portfolio invested in these stocks using optimisation approach. You can borrow up to 50% of portfolio value to invest in a stock, and can short-sell a stock with up to 50% value of your portfolio.

(Note: Data for the stocks may have inconsistent observations, for example, there might be a stock that does not have observations in some trading days. You need to explicitly account for this when preparing the stock data.)