BaşlayınÜcretsiz başlayın

Practice with PyPortfolioOpt: covariance

Portfolio optimization relies upon an unbiased and efficient estimate of asset covariance. Although sample covariance is unbiased, it is not efficient--extreme events tend to be overweighted.

One approach to alleviate this is through "covariance shrinkage", where large errors are reduced ('shrunk') to improve efficiency. In this exercise, you'll use pypfopt.risk_models's CovarianceShrinkage object to transform sample covariance into an efficient estimate. The textbook error shrinkage method, .ledoit_wolf(), is a method of this object.

Asset prices are available in your workspace. Note that although the CovarianceShrinkage object takes prices as input, it actually calculates the covariance matrix of asset returns, not prices.

Bu egzersiz, kursun bir parçasıdır

Quantitative Risk Management in Python

Kursa Göz Atın

Uygulamalı etkileşimli egzersiz

Bu egzersizi bu örnek kodu tamamlayarak deneyin.

# Import the CovarianceShrinkage object
from pypfopt.risk_models import ____

# Create the CovarianceShrinkage instance variable
cs = ____(prices)
Kodu Düzenle ve Çalıştır