VaR और जोखिम एक्सपोज़र
पहले आपने उस स्थिति में VaR और CVaR निकाले थे जब हानियाँ Normally distributed थीं. यहाँ आप scipy.stats में उपलब्ध एक और सामान्य loss distribution, Student's t-distribution (या T) का उपयोग करके VaR निकालेंगे.
आप T distribution से (30 - 1 = 29 degrees of freedom के साथ) 99% VaR मापों का एक array निकालेंगे, जिसके लिए investment bank पोर्टफोलियो losses पर 30-दिन की rolling windows ली जाएँगी.
सबसे पहले आप हर window का mean और standard deviation निकालेंगे और उन्हें rolling_parameters की एक list में रखेंगे. इन्हीं से आप 99% VaR मापों का array निकालेंगे.
फिर आप इस array का उपयोग करके उस पोर्टफोलियो का जोखिम एक्सपोज़र प्लॉट करेंगे जिसकी शुरुआती कीमत $100,000 है. याद रखिए, जोखिम एक्सपोज़र = हानि की प्रायिकता (यह 1% है) × हानि की राशि (यह 99% VaR द्वारा दी गई हानि है).
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Quantitative Risk Management
अभ्यास निर्देश
scipy.statsसे Student'st-distribution इम्पोर्ट करें.lossesसे 30-दिन की window का meanmuऔर standard deviationsigmaवेक्टर निकालें, और उन्हेंrolling_parametersमें रखें.rolling_parametersके एलिमेंट्स से बनी T distributions की list परt.ppf()का उपयोग करके 99% VaR मापों का Numpy arrayVaR_99निकालें.VaR_99array से जुड़े जोखिम एक्सपोज़र की गणना करें और उसे visualize करें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Import the Student's t-distribution
from scipy.____ import t
# Create rolling window parameter list
mu = losses.rolling(30).____
sigma = losses.rolling(30).____
rolling_parameters = [(29, mu[i], s) for i,s in enumerate(sigma)]
# Compute the 99% VaR array using the rolling window parameters
VaR_99 = np.array( [ t.ppf(____, *params)
for params in ____ ] )
# Plot the minimum risk exposure over the 2005-2010 time period
plt.plot(losses.index, 0.01 * ____ * 100000)
plt.show()