Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

you will write an R script to calculate the relative volatility for the three given stocks: enb, baba, and aapl the following are names of

you will write an R script to calculate the relative volatility for the three given stocks: enb, baba, and aapl
the following are names of files : "BABA.csv", "AAPL.csv", "ENB.csv"
These CSV files contain the historical trading data for the corresponding stocks trading
atNYSE/Nasdaq stock exchange, and each of them has the following information:
Date, Open Price, High Price, Low Price, Close Price, Adj Close, Volume
Your task is to write an R script that will calculate the covariance for each of the stocks to calculatethe volatility for the year 2019 using the closing price of the stocks. A higher value of covariancemeans the stock is more volatile.
How to calculate covariance?
To calculate the covariance, we need to know the mean and the standard deviation (sd). Then using the mean and the standard deviation, we can calculate the covariance (cv) using the following formula: cv = sd/mean
To DO:
Your R script should deliver the following:
1. The script should save the covariance for each of the three stocks to a data frame, and then the data frame should be saved to a CSV file named "covariance.csv"
2. All the covariances of the three stocks should be plotted on a single plot
3. Your program should save the stock tickers for the most and the least volatile stocks to a data frame, and then the data frame should be saved to another CSV file named "maxMin.csv
4.Make sure the script is well documented.
Important Notes:
Make sure that you show and everystep for exmaple where is project is being saved and ouput for each questions aksed above.Make sure that code runs propely I am also leaving a sample exmaple to that illustrates the output for all the 3 question. note that in the sample example thery are using five stocks where as we are only focusing on 3 stocks which are "baba", "enb", "aapl". The sample doesn;t use the same stocks it just to demontrates the outputs of the 3 questions asked above.
Hope anyone doing this question is clear and Thanks in advance
For Q1:
Figure-1: Covariance for the five stocks
For Q2:This picture has point since the sample example is testing 5 stocks in our case
there are only 3 "baba","enb","aapl"
For Q3:
maxMin.csv - Notepad
File Edit Format View Help
"Ticker"
"acst"
"bac"
Figure-3: The most and the least volatile stocks
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Can an object exert a force on itself? Argue for your answer.

Answered: 1 week ago

Question

Explain all drawbacks of application procedure.

Answered: 1 week ago

Question

Explain the testing process of accounting 2?

Answered: 1 week ago