शुरू करेंमुफ़्त में शुरू करें

Efficient frontier और वित्तीय संकट

पहले आपने वित्तीय संकट से पहले, दौरान, और बाद के निवेश बैंक पोर्टफोलियो की covariance मैट्रिक्स देखी थी. अब आप efficient frontier में आए बदलावों को विज़ुअलाइज़ करेंगे, ताकि दिखाया जा सके कि संकट ने किसी भी दिए गए रिटर्न के लिए बेसलाइन जोखिम को कितना बढ़ा दिया.

PyPortfolioOpt की pypfopt लाइब्रेरी के Critical Line Algorithm (CLA) ऑब्जेक्ट का उपयोग करके, आप संकट अवधि के दौरान की efficient frontier निकालेंगे और विज़ुअलाइज़ करेंगे, और उसे उस scatterplot में जोड़ेंगे जिसमें संकट से पहले और बाद की efficient frontiers पहले से दिखाई जा रही हैं.

Expected returns returns_during और efficient covariance मैट्रिक्स ecov_during उपलब्ध हैं, साथ ही pypfopt का CLA ऑब्जेक्ट भी. (ध्यान रखें कि DataCamp के प्लॉट्स को अलग विंडो में expand किया जा सकता है, जिससे पढ़ना आसान हो जाता है.)

यह अभ्यास पाठ्यक्रम का हिस्सा है

Python में Quantitative Risk Management

पाठ्यक्रम देखें

अभ्यास निर्देश

  • Expected returns और efficient covariance of returns का उपयोग करके critical line algorithm (CLA) ऑब्जेक्ट efficient_portfolio_during बनाएँ.
  • efficient_portfolio_during के minimum variance पोर्टफोलियो को प्रिंट करें.
  • efficient_portfolio_during की efficient frontier की गणना करें.
  • संकट से पहले और बाद की efficient frontiers वाले पहले से दिख रहे scatterplots में efficient frontier के परिणाम जोड़ें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

# Initialize the Crtical Line Algorithm object
efficient_portfolio_during = CLA(____, ecov_during)

# Find the minimum volatility portfolio weights and display them
print(efficient_portfolio_during.____)

# Compute the efficient frontier
(ret, vol, weights) = efficient_portfolio_during.____

# Add the frontier to the plot showing the 'before' and 'after' frontiers
plt.scatter(vol, ____, s = 4, c = 'g', marker = '.', label = 'During')
plt.legend()
plt.show()
कोड संपादित करें और चलाएँ