Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Corporate Treasury And Cash Management

Authors: Robert Cooper

1st Edition

1349512699, 9781349512690

More Books

Students also viewed these Finance questions

Question

Identify the two factors in the two-factor theory of emotion.

Answered: 1 week ago