BUSI 4624 – Programming for FinTech Coursework 2: Financial analysis with PythonPython

Java 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, BUSI 4624 – Programming for FinTech Coursework 2: Financial analysis with PythonPython 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         

资源下载链接为: https://pan.quark.cn/s/22ca96b7bd39 在C#开发中,Windows Media Player控件是集成音频和视频播放功能的强大工具。本文将介绍如何在C#中实现不同的播放模式,如随机播放、列表循环和单曲循环,这些功能在多媒体应用中十分常见 。 要使用Windows Media Player控件,首先需要将其添加到C#项目中。在Visual Studio中,可以通过在工具箱中搜索“Windows Media Player”,并将其拖放到窗体上完成 。接着,设置控件的基本属性,如URL,以指定要播放的媒体文件 。 随机播放模式会在一首歌曲播放结束后,随机选择播放列表中的下一首歌曲。可以通过创建一个包含所有歌曲URL的数组,并利用Random类生成随机索引来实现。例如: 列表循环模式会在一首歌曲播放结束后,自动从播放列表的开头重新开始播放。实现方法是检测到播放结束后,将URL重置为列表的第一个元素: 单曲循环模式则是在一首歌曲播放结束后,重新播放当前歌曲。可以通过将播放器的当前播放位置重置为0并重新播放来实现: 以上代码均需在windowsMediaPlayer1_PlayStateChange事件处理器中实现,该事件会在播放器的播放状态改变时触发 。需要注意的是,这些示例假设已正确引用了WMPLib命名空间,并且Windows Media Player控件的ID为“windowsMediaPlayer” 。 在实际应用中,除了实现播放模式外,还可能需要考虑错误处理、用户界面更新等因素。为了使播放列表更具动态性,可以考虑从数据库或XML文件加载歌曲信息,而不是硬编码在代码中,从而提升用户体验 。通过这些方法,可以在C#中灵活实现Windows Media Player的各种播放模式,满足不同多媒体应用场景的需求 。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值