Question: ValueError Traceback ( most recent call last ) Cell In [ 2 ] , line 4 3 4 0 weights = np . array (

ValueError Traceback (most recent call last)
Cell In[2], line 43
40 weights = np.array([0.4,0.2,0.4])
42 # Calculate the Parametric VaR
--->43 var_99= parametric_var(weights, returns_data, confidence_level=0.99)
44 print(f"Parametric VaR at 99% confidence level: {var_99:.2%}")
Cell In[2], line 18, in parametric_var(weights, returns_data, confidence_level)
6"""
7 Calculate the Parametric Value at Risk (VaR) for a portfolio.
8
(...)
15- float: The Parametric VaR of the portfolio.
16"""
17 # Calculate the portfolio's mean return and covariance matrix
--->18 portfolio_mean_return = np.dot(weights, returns_data.mean())
19 portfolio_covariance_matrix = returns_data.cov()
21 # Calculate the portfolio standard deviation
ValueError: shapes (3,) and (0,) not aligned: 3(dim 0)!=0(dim 0)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!