Question: You are a financial analyst analyzing the stocks of two companies, A and B. You have data on the closing prices of each company's stock
You are a financial analyst analyzing the stocks of two companies, A and B. You have data on the closing prices of each company's stock for the past n days. Your task is to determine which company's stock was more volatile over the past n days. To measure volatility, you will calculate the standard deviation of each company's closing prices. Write a function that takes in two arrays of length n, one for company A and one for company B, and returns the string "A" or "B", indicating which company's stock was more volatile.
Example:
Input:
A = [23.50, 23.75, 24.10, 22.90, 23.15, 23.45]
B = [55.00, 54.80, 54.50, 54.20, 54.40, 54.60]
Output: "B" (company B's stock was more volatile)
Step by Step Solution
3.39 Rating (143 Votes )
There are 3 Steps involved in it
The detailed answer for the above question is provided below To solve this problem we will first cal... View full answer
Get step-by-step solutions from verified subject matter experts
