联系方式

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

您当前位置:首页 >> Python编程Python编程

日期:2021-12-16 10:32

Submit your assignment in a single Python (.py) file on Avenue2Learn. Please name

the file FirstName_LastName.py. Answer each question in a cell (use #%% to define a

cell). Use # to add extra notes to your code. Make sure that all cells can be executed

without any error. All functions that you need are listed in the

TeachingNote_Python.pdf file but you are allowed to use other functions that do the

task.

1. Download and import stock price data for Amazon.com, Inc. (AMZN), and American Airlines

Group Inc. (AAL) from Yahoo Finance Website from Jan 2016 to Nov 2021 at the daily frequency.

You may either

– Use the Pandas_DataReader library and download data directly from Python.

– Or download prices from Yahoo Finance Historical tab, export them in CSV files and then

import the CSV file to a Pandas dataFrame. [this could be a solution for students in

China who do not get easy access to Yahoo Finance]

2. In a time‐series dataFrame, find the daily returns for each stock from the adj close price data of

each stock. Drop  

3. Find the variance of the daily returns for each company.

4. Compute the simple moving average volatility (SMA) with a 45‐day window. Plot them on the

same graph. Notice how COVID‐19 shock affected the two companies differently.

5. Similarly, compute and plot exponentially weighted average volatility (EWMA),

For this step, on the returns’ dataFrame, create two new columns called EMWA_variance_AMZN and

EMWA_variance_AAL. Then use a for loop

(for time ??) that iterates from day 2 to the end of the sample. In each iteration, calculate the variance for

each day based on the previous day’s variance and returns following the above equation.


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

python代写
微信客服:codinghelp