-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy path30stocks-diversifiaction
20 lines (20 loc) · 1.04 KB
/
30stocks-diversifiaction
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from matplotlib.pyplot import *
n=[1,2,4,6,8,10,12,14,15,18,20,25,30,35,40,45,50,75,100,300,400,500,600,700,800,900,1000]
port_sigma=[0.49236,0.37358,0.29687,0.26643,0.24983,0.23932,0.23204,
0.22670,0.22261,0.21939,0.21677,0.21196,0.20870,0.20643,0.20456,0.20316,0.20203,0.19860,0.19686,0.19432,0.19336,0.19292,0.19265,0.19347,0.19233,0.19224,0.19217,0.19211,0.19158]
xlim(0,50)
ylim(0.1,0.4)
hlines(0.19217, 0, 50, colors='r', linestyle='dashed')
annotate('',xy=(30, 0.19),xycoords = 'data', xytext = (5, 0.28),
textcoords = 'data',arrowprops = {'arrowstyle':'<->'})
annotate('',xy=(30, 0.19), xycoords = 'data', xytext = (5, 0.28),
textcoords = 'data', arrowprops = {'arrowstyle':'<->'})
annotate('Total portfolio risk', xy=(5,0.3), xytext=(25,0.25),
arrowprops=dict(facecolor='black',shrink=0.02))
figtext(0.15,0.4,"Diversiable risk")
figtext(0.65,0.25,"Nondiversable risk")
plot(n[0:17],port_sigma[0:17])
title("Relationship between n and protfolio risk")
xlabel("Number of stocks in a portfolio")
ylabel("Ratio of Portfolio std to std of one stock")
show()