0% found this document useful (0 votes)
108 views23 pages

FRA Main Project Part B Guided

Financial Project - b

Uploaded by

sagesubbu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views23 pages

FRA Main Project Part B Guided

Financial Project - b

Uploaded by

sagesubbu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Problem Statement

Context
Investors face market risk, arising from asset price fluctuations due to economic
events, geopolitical developments, and investor sentiment changes.
Understanding and analyzing this risk is crucial for informed decision-making and
optimizing investment strategies.

Objective
The objective of this analysis is to conduct Market Risk Analysis on a portfolio of
Indian stocks using Python. It uses historical stock price data to understand
market volatility and riskiness. Using statistical measures like mean and
standard deviation, investors gain a deeper understanding of individual stocks'
performance and portfolio variability.

Through this analysis, investors can aim to achieve the following objectives:

1. Risk Assessment: Analyze historical volatility of individual stocks and the


overall portfolio.
2. Portfolio Optimization: Use Market Risk Analysis insights to enhance risk-
adjusted returns.
3. Performance Evaluation: Assess portfolio management strategies'
effectiveness in mitigating market risk.
4. Portfolio Performance Monitoring: Monitor portfolio performance over time
and adjust as market conditions and risk preferences change.

Data Dictionary
The dataset contains weekly stock price data for 5 Indian stocks over an 8-year
period. The dataset enables us to analyze the historical performance of
individual stocks and the overall market dynamics.

Please read the instructions


carefully before starting the
project.
This is a commented Python Notebook file in which all the instructions and tasks
to be performed are mentioned.

Blanks '_______' are provided in the notebook that needs to be filled with an
appropriate code to get the correct result. With every '_______' blank, there is
a comment that briefly describes what needs to be filled in the blank space.
Identify the task to be performed correctly, and only then proceed to write
the required code.
Fill the code wherever asked by the commented lines like "# write your code
here" or "# complete the code". Running incomplete code may throw error.
Please run the codes in a sequential manner from the beginning to avoid any
unnecessary errors.
Add the results/observations (wherever mentioned) derived from the analysis
in the presentation and submit the same.

Importing necessary Libraries

Loading the data


In [ ]: import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

%matplotlib inline

import warnings
warnings.filterwarnings('ignore')

In [ ]: df = pd.read_csv('Market_Risk_Data.csv') ## Fill the blank to read the dat


df.head()

Out[ ]: Dish Hindustan Vodafone


Date Infosys Cipla
TV Unilever Idea

28-03-
0 86 608 867 67 514
2016

04-04-
1 86 607 863 65 519
2016

11-04-
2 85 583 853 66 506
2016

18-04-
3 87 625 900 69 515
2016

25-04-
4 89 606 880 71 532
2016
Overview of the Dataset
In [ ]: df.shape ## Complete the code to view dimensions of the data

Out[ ]: (418, 6)

In [ ]: df.info() ## Complete the code to view information about the data

<class 'pandas.core.frame.DataFrame'>
RangeIndex: 418 entries, 0 to 417
Data columns (total 6 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Date 418 non-null object
1 Dish TV 418 non-null int64
2 Infosys 418 non-null int64
3 Hindustan Unilever 418 non-null int64
4 Vodafone Idea 418 non-null int64
5 Cipla 418 non-null int64
dtypes: int64(5), object(1)
memory usage: 19.7+ KB

In [ ]: df.describe() ## Complete the code to print the statistical summary of the

Out[ ]: Hindustan Vodafone


Dish TV Infosys Cipla
Unilever Idea

count 418.000000 418.000000 418.000000 418.000000 418.000000

mean 38.648325 1007.210526 1906.344498 23.234450 756.614833

std 31.944620 455.089501 597.800173 20.264854 252.969619

min 4.000000 445.000000 788.000000 3.000000 370.000000

25% 14.000000 591.250000 1368.500000 9.000000 556.000000

50% 19.500000 777.500000 2083.000000 12.000000 637.000000

75% 73.000000 1454.000000 2419.000000 43.000000 946.000000

max 108.000000 1939.000000 2798.000000 71.000000 1493.000000

In [ ]: df.isna().sum() ## Complete the code to view number of null or NaN values i


Out[ ]: 0

Date 0

Dish TV 0

Infosys 0

Hindustan Unilever 0

Vodafone Idea 0

Cipla 0

dtype: int64

In [ ]: # Convert object to DateTime


df['Date'] = pd.to_datetime(df['Date']) ## Complete the code to convert Da
df.head()

Out[ ]: Dish Hindustan Vodafone


Date Infosys Cipla
TV Unilever Idea

2016-03-
0 86 608 867 67 514
28

2016-04-
1 86 607 863 65 519
04

2016-04-
2 85 583 853 66 506
11

2016-04-
3 87 625 900 69 515
18

2016-04-
4 89 606 880 71 532
25

Stock Price Analysis


In [ ]: numeric_columns = df.select_dtypes(include=['number']).columns ## Complete

for i, stock in enumerate(numeric_columns):


plt.figure(figsize=(10, 6))
plt.scatter(df.index, df[stock]) ## Complete the code to plot a scatter
plt.title(f'{stock} Price Over Time')
plt.xlabel('Date')
plt.ylabel('Stock Price')
plt.grid(True)
plt.show()
Inference

***Vodafone and Dish TV prices are decreased over the Time

****Wheras INFOSYS,CIPLA and Hindustan


Lever prices are increased with minimal dips.

Returns and Volatility Analysis

Return Calculation
In [ ]: Return_of_Stocks = np.log(df.drop(['Date'],axis=1)).diff(axis = 0)

# Set the display options to show all rows and columns


pd.set_option('display.max_rows', None) # Set to None to display all rows

Return_of_Stocks
Out[ ]: Dish TV Infosys Hindustan Unilever Vodafone Idea Cipla

0 NaN NaN NaN NaN NaN

1 0.000000 -0.001646 -0.004624 -0.030305 0.009681

2 -0.011696 -0.040342 -0.011655 0.015267 -0.025367

3 0.023257 0.069564 0.053635 0.044452 0.017630

4 0.022728 -0.030872 -0.022473 0.028573 0.032477

5 0.011173 -0.001652 -0.014883 0.000000 0.009355

6 0.000000 -0.023412 -0.018627 -0.028573 0.001860

7 0.064539 0.023412 -0.021378 0.000000 -0.007463

8 -0.010471 -0.004971 -0.019395 -0.044452 -0.045985

9 -0.087969 0.031074 0.055934 0.029853 -0.066894

10 0.011429 0.017558 0.027399 -0.060625 -0.016914

11 0.033523 -0.072162 -0.023933 -0.031749 0.012712

12 0.021740 0.003396 0.009185 -0.016261 0.024949

13 0.000000 -0.006803 -0.019620 0.000000 -0.024949

14 0.072571 0.003407 0.047791 0.048009 0.073055

15 -0.020203 -0.006826 0.029559 -0.015748 0.027029

16 0.010152 -0.080185 0.018173 0.076373 -0.015355

17 -0.010152 -0.013072 -0.047731 -0.060625 -0.005820

18 0.059423 0.007491 0.032790 -0.015748 0.028765

19 -0.049271 -0.003738 -0.003231 0.015748 0.009407

20 -0.117783 -0.005634 0.008593 -0.115832 -0.034289

21 0.065958 -0.042314 -0.024907 0.000000 0.076458

22 0.021053 0.000000 -0.006601 -0.017700 0.019556

23 -0.010471 0.013659 0.016421 -0.093526 0.017452

24 0.000000 -0.005831 0.004334 -0.019803 -0.010435

25 0.051293 0.019306 -0.010870 0.019803 0.039422

26 -0.010050 -0.003831 -0.006579 -0.019803 0.023257

27 -0.051825 -0.005775 -0.034699 -0.040822 -0.040206

28 0.031416 -0.019494 0.002275 0.020619 -0.025975

29 -0.042111 0.017561 -0.041769 -0.085158 0.032790

30 0.031749 0.003861 0.009434 0.043485 -0.006814

31 0.000000 -0.039298 -0.018958 -0.021506 -0.017242

32 -0.075712 -0.014127 0.016608 -0.021979 -0.044452


Dish TV Infosys Hindustan Unilever Vodafone Idea Cipla

33 -0.022728 -0.065081 -0.058128 -0.068993 -0.003643

34 0.033902 0.004329 0.001246 0.023530 0.003643

35 -0.022473 0.056678 0.033071 0.022990 0.033962

36 -0.022990 -0.014389 0.003608 0.000000 0.008749

37 0.034289 0.016427 0.014303 0.044452 0.003478

38 -0.069796 0.024146 -0.033698 0.000000 -0.019282

39 0.011976 -0.018055 -0.036141 -0.067441 0.027925

40 0.011834 0.024001 0.049515 0.045462 -0.019114

41 0.011696 -0.040328 0.012005 -0.022473 0.024265

42 0.022990 -0.008265 -0.012005 -0.046520 -0.012059

43 -0.034686 -0.020965 0.032088 0.023530 -0.005213

44 0.034686 -0.006376 0.002336 0.110001 0.008673

45 0.000000 0.000000 -0.008202 0.333492 0.052156

46 0.000000 0.035606 0.005865 -0.061558 -0.045272

47 0.000000 0.024391 -0.004689 0.061558 0.017007

48 0.055263 0.011976 0.009357 0.057987 -0.001688

49 0.031749 0.011834 0.020738 -0.057987 0.000000

50 0.080043 0.001959 -0.002283 -0.061558 -0.005080

51 0.019048 0.003906 0.029281 0.046520 0.015165

52 0.009390 0.001947 -0.001110 -0.182322 -0.001674

53 0.009302 0.003884 0.015436 -0.056089 -0.003356

54 -0.076961 -0.047628 0.009799 0.019048 -0.006745

55 0.009950 -0.056441 0.000000 -0.019048 -0.018788

56 -0.020001 -0.012987 -0.014185 0.000000 -0.026202

57 -0.041243 0.000000 0.027102 0.000000 -0.014260

58 0.010471 0.021553 0.021165 -0.059423 -0.012647

59 0.030772 0.027341 0.026861 0.115513 0.030441

60 0.010050 -0.006244 0.030123 -0.037041 0.000000

61 -0.127833 0.032857 0.029242 -0.078472 -0.141881

62 -0.046520 -0.020409 0.047829 -0.020619 0.076283

63 -0.011976 -0.027170 0.003656 0.000000 0.033336

64 -0.036814 -0.004246 -0.001826 -0.021053 -0.022100

65 -0.077962 0.004246 0.003650 0.021053 0.007421


Dish TV Infosys Hindustan Unilever Vodafone Idea Cipla

66 0.077962 -0.002121 -0.004564 0.060625 0.032730

67 0.000000 0.002121 0.008201 0.000000 0.001787

68 0.000000 0.033336 0.033902 0.057158 -0.019838

69 -0.025318 0.008163 0.019114 0.018349 0.026956

70 0.050010 0.008097 -0.001723 0.035718 0.007067

71 -0.024693 -0.008097 0.011145 -0.017700 -0.003527

72 -0.119347 0.004057 -0.016330 -0.074108 -0.010657

73 0.094029 -0.066971 0.040753 0.037740 0.012423

74 0.037740 0.021414 -0.017625 0.000000 0.015748

75 0.000000 -0.025752 0.028383 -0.018692 -0.003478

76 -0.037740 -0.033152 -0.007435 -0.099091 -0.033661

77 0.012739 0.022223 0.035834 0.020619 0.014312

78 -0.038715 -0.011050 -0.008032 -0.020619 0.033191

79 -0.013245 0.000000 -0.054695 -0.021053 0.006849

80 -0.040822 0.021979 0.036793 -0.043485 -0.001708

81 0.000000 0.017242 0.025933 0.064539 0.016950

82 -0.013986 -0.006431 0.012719 0.136132 0.029804

83 0.094029 0.025479 -0.004751 0.018019 0.016182

84 -0.025975 -0.031952 -0.016807 0.133531 0.022223

85 0.013072 0.040302 0.044206 -0.064539 -0.043311

86 -0.013072 0.006218 -0.011651 -0.051293 -0.006579

87 0.075986 0.038505 -0.014955 0.000000 0.017989

88 -0.012270 -0.026185 -0.003177 -0.017700 -0.029607

89 0.024391 0.014185 0.055699 0.035091 0.021471

90 -0.012121 0.017947 -0.006795 -0.017392 -0.057158

91 -0.012270 0.027292 0.026907 0.067823 0.039021

92 0.012270 -0.001925 0.008079 0.063513 0.011580

93 0.047628 -0.013579 -0.013255 0.015267 0.016314

94 -0.084899 0.053245 0.019817 0.000000 -0.009756

95 -0.078988 0.047025 -0.009493 -0.062520 -0.013158

96 0.013606 0.029593 0.005123 -0.084083 0.034177

97 -0.027399 -0.022551 -0.013226 -0.091808 -0.081644

98 0.027399 -0.023071 -0.008915 -0.019418 0.088024


Dish TV Infosys Hindustan Unilever Vodafone Idea Cipla

99 -0.013606 0.012489 0.014080 -0.019803 -0.027399

100 0.013606 0.021053 -0.032152 0.000000 -0.026492

101 -0.027399 0.006920 0.003035 0.000000 -0.023770

102 -0.087011 0.013699 -0.011429 -0.040822 -0.012100

103 0.044452 -0.010257 0.002296 0.020619 -0.019316

104 0.000000 0.001717 -0.003830 -0.041673 -0.047196

105 0.056353 -0.022551 0.009167 -0.021506 0.018417

106 -0.013793 -0.014135 0.039513 -0.021979 0.032319

107 0.092782 -0.019767 0.029530 -0.045462 -0.023236

108 -0.012739 0.058166 0.043062 0.000000 0.040750

109 -0.052644 0.011915 0.002716 0.000000 0.044150

110 0.013423 0.000000 -0.002036 -0.123614 -0.004996

111 -0.040822 0.001691 0.028793 -0.203599 -0.040892

112 -0.028171 -0.003384 0.062680 0.031749 -0.077727

113 0.068993 0.043124 -0.017511 0.145182 0.003752

114 -0.013423 -0.008150 0.003150 0.026668 -0.011300

115 0.000000 0.035373 0.003766 0.025975 0.058841

116 -0.013606 0.014118 0.021080 -0.025975 0.088795

117 -0.013793 -0.020457 -0.008626 -0.054067 0.004890

118 0.000000 0.043553 0.015352 0.000000 0.008097

119 0.013793 -0.013793 0.024678 -0.087011 -0.004850

120 0.013606 0.016833 0.039632 -0.030772 0.019262

121 -0.084557 0.025470 -0.047391 -0.031749 -0.009585

122 -0.014815 0.013226 -0.001799 0.092373 0.015924

123 0.014815 -0.002924 0.054888 -0.029853 0.021876

124 -0.029853 0.017417 -0.012004 0.000000 -0.039406

125 0.058841 -0.001440 0.028905 -0.062520 0.044032

126 0.028171 -0.002886 0.000559 0.031749 0.004605

127 -0.013986 0.045205 0.000558 -0.064539 0.019713

128 -0.043172 0.019152 -0.092914 -0.068993 -0.001503

129 0.000000 -0.004073 -0.007993 0.000000 0.011958

130 -0.092373 -0.040255 0.001234 -0.036368 -0.016480

131 -0.084083 0.044329 -0.009913 -0.160343 -0.013688


Dish TV Infosys Hindustan Unilever Vodafone Idea Cipla

132 -0.111226 -0.017772 -0.034847 -0.139762 -0.024807

133 0.093526 -0.050930 -0.000645 0.095310 -0.022223

134 -0.175204 0.000000 0.024220 0.000000 0.019078

135 -0.136576 -0.083192 -0.018431 0.000000 -0.053368

136 0.047628 0.046233 0.047598 0.127833 0.008271

137 -0.023530 0.003008 0.022378 0.039221 -0.135652

138 -0.100083 -0.010566 0.012482 -0.039221 0.009390

139 0.000000 -0.059392 -0.008899 0.000000 -0.028438

140 0.000000 0.080414 0.053377 -0.174353 0.041437

141 -0.141079 -0.004468 0.015139 -0.048790 -0.060855

142 0.141079 0.060800 0.037142 0.095310 0.027081

143 0.025975 -0.080394 -0.027727 0.044452 -0.009588

144 -0.025975 0.004556 0.008782 0.000000 0.005764

145 0.051293 0.007547 -0.020984 -0.044452 -0.011561

146 0.000000 0.061244 -0.011788 0.000000 -0.011696

147 -0.162519 0.042913 -0.012500 -0.046520 0.000000

148 -0.435318 -0.009530 0.005701 -0.048790 -0.001963

149 0.087011 0.034950 0.023041 -0.051293 0.023302

150 0.223144 0.013124 0.006093 0.000000 0.033966

151 0.095310 -0.033138 -0.020079 -0.054067 0.005550

152 0.114410 -0.008119 -0.001692 0.000000 0.000000

153 0.102654 0.008119 -0.021101 0.000000 0.018282

154 -0.075986 -0.039868 -0.015099 0.105361 -0.018282

155 0.051293 0.012544 0.000585 0.000000 -0.016745

156 -0.077962 0.027324 -0.021277 -0.051293 -0.013220

157 0.052644 0.000000 0.021277 -0.054067 -0.019194

158 0.000000 0.027909 -0.026668 -0.057158 0.038027

159 0.000000 -0.051086 0.035402 -0.060625 0.034834

160 -0.025975 -0.011096 0.008658 0.060625 0.008969

161 -0.054067 0.028868 0.004015 -0.060625 0.014185

162 0.000000 -0.031661 -0.034948 0.060625 -0.021353

163 -0.028171 0.002793 0.002959 -0.194156 -0.007220

164 -0.121361 0.004175 0.039403 -0.154151 0.014389


Dish TV Infosys Hindustan Unilever Vodafone Idea Cipla

165 -0.066691 -0.018221 -0.006270 0.080043 0.017700

166 0.000000 0.032014 0.025404 0.074108 -0.019487

167 -0.035091 0.013606 0.025318 -0.074108 -0.014415

168 0.035091 0.004046 -0.004357 -0.080043 0.009033

169 -0.035091 0.012040 -0.034994 0.000000 -0.012670

170 -0.036368 -0.022866 0.016817 0.000000 0.012670

171 0.105361 -0.026190 -0.007813 0.000000 -0.016319

172 0.032790 0.063578 -0.040005 0.000000 0.023488

173 0.031749 0.029699 0.004073 -0.087011 -0.041939

174 0.000000 0.005076 0.004057 -0.200671 -0.009355

175 -0.287682 -0.021754 -0.000579 -0.405465 -0.034420

176 -0.042560 0.021754 0.063344 -0.182322 -0.060138

177 0.042560 -0.017880 -0.005993 0.182322 -0.012474

178 -0.042560 0.025447 0.020552 0.000000 -0.021142

179 -0.044452 0.023589 0.007467 -0.182322 0.008511

180 0.044452 0.026636 -0.034048 0.000000 0.006336

181 0.000000 -0.005992 -0.009945 0.000000 -0.016986

182 -0.090972 -0.030509 0.096773 0.182322 0.002139

183 -0.100083 -0.027640 0.012024 0.000000 -0.084683

184 -0.111226 0.012658 -0.032391 -0.182322 -0.023530

185 0.000000 -0.010114 0.039339 0.182322 0.048790

186 0.000000 -0.024439 0.041178 0.000000 0.006780

187 -0.348307 -0.187020 0.017874 -0.405465 0.035402

188 0.287682 0.068260 0.015727 0.000000 0.023632

189 -0.133531 0.024621 -0.046018 0.000000 -0.025808

190 0.000000 0.008547 -0.010143 0.000000 0.008677

191 0.133531 -0.017168 -0.018619 0.405465 0.031884

192 -0.287682 0.014327 0.007882 0.287682 -0.016878

193 0.080043 0.018323 -0.003933 -0.287682 -0.028049

194 0.074108 -0.005602 -0.014889 0.154151 0.013044

195 0.000000 0.027703 -0.025831 -0.154151 0.008602

196 -0.074108 0.005450 0.000513 0.000000 0.029538

197 0.000000 0.013495 -0.011865 0.000000 -0.023135


Dish TV Infosys Hindustan Unilever Vodafone Idea Cipla

198 0.000000 0.018593 0.017490 0.000000 0.008475

199 0.000000 0.015666 0.049251 -0.182322 0.012579

200 0.074108 0.009026 0.002908 0.182322 -0.046917

201 -0.074108 0.003844 0.004347 -0.182322 -0.031045

202 -0.080043 -0.010283 0.040147 0.000000 0.000000

203 0.000000 0.020461 0.039933 -0.223144 0.000000

204 -0.087011 0.012579 -0.004905 0.223144 -0.018182

205 -0.200671 -0.082024 -0.021234 -0.223144 -0.068829

206 -0.405465 -0.017796 -0.023096 -0.287682 0.043276

207 -0.182322 -0.151851 -0.067659 0.693147 -0.021404

208 0.000000 -0.141371 -0.025318 -0.693147 -0.117182

209 -0.223144 0.146183 0.085001 0.000000 0.112363

210 0.000000 -0.064432 0.014496 0.000000 0.081157

211 0.223144 0.070811 0.100194 0.000000 0.298206

212 -0.223144 0.017337 0.016247 0.287682 -0.011638

213 0.223144 0.032286 -0.048687 0.000000 0.003339

214 0.000000 0.042938 -0.078959 0.000000 -0.018503

215 0.000000 -0.011662 -0.022313 0.000000 0.020169

216 0.000000 -0.032790 -0.019879 0.223144 -0.051206

217 0.000000 0.047346 -0.026801 0.182322 0.112515

218 -0.223144 0.010065 0.042832 0.000000 0.015528

219 0.405465 0.012793 0.015304 0.693147 0.012251

220 0.154151 -0.021414 0.003790 -0.087011 -0.021539

221 0.251314 0.020001 -0.002367 -0.200671 0.071995

222 -0.117783 0.038840 0.019245 0.200671 -0.081370

223 0.117783 0.040005 0.013392 -0.095310 0.004699

224 -0.117783 0.029622 0.026704 0.000000 0.001561

225 0.000000 0.141746 0.041983 -0.105361 0.072212

226 0.000000 0.015301 -0.051406 -0.117783 -0.022011

227 -0.133531 0.040388 -0.003613 0.000000 0.071561

228 0.133531 -0.011524 0.003613 0.117783 0.048527

229 0.000000 0.005255 -0.016822 0.000000 0.024693

230 0.117783 -0.007365 0.011397 0.000000 -0.020753


Dish TV Infosys Hindustan Unilever Vodafone Idea Cipla

231 0.287682 -0.012753 -0.024783 0.105361 -0.014522

232 0.080043 -0.017260 -0.012155 0.262364 -0.032435

233 0.143101 0.040517 0.019101 -0.167054 0.001373

234 0.000000 0.044951 -0.031883 0.000000 0.100410

235 -0.143101 0.013889 -0.007652 0.000000 -0.043099

236 0.074108 0.002951 0.008128 -0.200671 0.005168

237 0.000000 0.098164 0.021202 0.000000 0.036690

238 -0.074108 0.010629 0.004187 -0.117783 -0.027710

239 -0.080043 -0.011520 -0.001859 0.117783 -0.028499

240 -0.087011 -0.052138 -0.036954 0.000000 -0.003950

241 0.087011 0.058357 0.022902 0.000000 0.047659

242 -0.182322 -0.004439 0.030200 0.000000 -0.064958

243 0.000000 -0.017048 -0.020810 0.105361 -0.004035

244 0.000000 -0.004535 -0.000935 0.000000 0.005376

245 0.095310 0.041840 0.023574 0.000000 0.027761

246 0.241162 0.018999 0.084076 0.000000 0.014240

247 0.000000 0.016123 -0.016088 0.000000 0.019097

248 0.000000 0.041226 0.026118 0.000000 0.055195

249 0.000000 0.024732 0.000000 0.182322 -0.008388

250 -0.074108 0.055932 0.008282 0.000000 0.009581

251 0.000000 -0.002985 -0.021255 0.154151 -0.020470

252 -0.080043 0.005218 0.019191 -0.074108 -0.011009

253 0.000000 -0.072451 -0.060909 -0.167054 0.002457

254 0.000000 0.027593 0.004819 0.087011 0.044398

255 0.000000 0.026095 -0.016304 0.000000 -0.002350

256 0.000000 -0.019121 -0.020647 -0.087011 -0.046968

257 0.000000 -0.025021 -0.032261 0.000000 -0.019926

258 0.000000 0.047923 0.034526 0.000000 0.016220

259 -0.087011 0.033398 -0.001812 -0.095310 0.000000

260 -0.095310 -0.014706 0.046067 0.000000 -0.058616

261 -0.105361 -0.010425 0.003457 -0.105361 0.032282

262 0.105361 0.040343 0.034764 0.105361 0.047155

263 0.000000 0.057957 0.017349 -0.105361 0.075838


Dish TV Infosys Hindustan Unilever Vodafone Idea Cipla

264 -0.105361 -0.095310 -0.000819 0.000000 0.059963

265 0.000000 -0.005988 -0.048708 0.000000 -0.009569

266 0.000000 0.006734 0.008142 -0.117783 -0.018329

267 0.287682 0.006689 0.033574 0.000000 -0.029820

268 0.000000 -0.022473 -0.015807 0.117783 0.003358

269 0.080043 0.027645 -0.012658 0.000000 0.039436

270 0.207639 0.032623 -0.012821 0.000000 0.003217

271 0.000000 -0.007877 0.012396 0.105361 0.019089

272 -0.064539 0.055920 0.001698 0.000000 0.021819

273 0.000000 0.014845 0.048022 0.000000 -0.015536

274 -0.068993 0.052197 -0.009748 0.095310 0.004167

275 0.000000 -0.002546 0.019803 -0.200671 0.017517

276 0.068993 0.001274 -0.018579 0.000000 -0.019598

277 -0.068993 -0.016688 -0.021843 0.105361 0.012423

278 0.000000 0.031223 -0.018079 -0.223144 -0.025001

279 0.000000 0.020491 -0.006384 0.000000 -0.021323

280 -0.074108 0.020682 0.015675 -0.133531 -0.017392

281 0.000000 0.027903 0.010454 -0.154151 -0.017700

282 0.000000 0.016261 0.087947 0.000000 0.002230

283 0.000000 -0.019192 0.025204 0.000000 0.028542

284 0.000000 0.001174 0.035757 0.154151 0.023530

285 0.325422 -0.012987 0.002863 0.133531 0.000000

286 0.105361 0.001188 -0.028273 0.318454 0.007372

287 0.139762 0.048649 0.016409 0.000000 0.012513

288 -0.139762 -0.056394 -0.023789 0.087011 0.021528

289 0.000000 0.005963 -0.021716 -0.087011 -0.066027

290 -0.051293 0.033902 0.011665 0.000000 -0.013086

291 0.000000 -0.010399 -0.085482 -0.095310 -0.016602

292 -0.054067 -0.025884 -0.025172 0.000000 0.023167

293 -0.057158 0.030519 0.023132 0.000000 0.001090

294 0.000000 0.029615 -0.018546 0.000000 -0.003273

295 0.057158 0.001122 0.002078 0.095310 -0.024337

296 -0.057158 -0.053538 -0.031628 0.087011 0.086825


Dish TV Infosys Hindustan Unilever Vodafone Idea Cipla

297 0.111226 0.022801 0.004275 0.223144 -0.062487

298 0.100083 0.021162 0.003407 0.125163 -0.022100

299 -0.154151 0.019614 -0.055060 -0.194156 -0.035251

300 0.054067 0.031679 0.031398 -0.074108 0.055163

301 0.000000 0.014942 0.034656 0.143101 0.036563

302 -0.054067 -0.039433 0.019572 0.000000 -0.034375

303 0.000000 0.066087 -0.025476 -0.143101 0.001092

304 -0.057158 -0.094022 -0.010632 -0.167054 -0.049227

305 0.000000 -0.026990 -0.021172 0.000000 0.074026

306 0.000000 0.002326 0.002181 0.000000 0.007427

307 -0.060625 -0.018758 -0.033226 0.000000 0.001057

308 0.000000 0.006488 0.034532 0.000000 -0.047577

309 -0.133531 -0.011233 -0.060081 -0.095310 0.018651

310 0.000000 0.008878 -0.088862 0.000000 0.002172

311 0.133531 0.076546 0.056457 0.000000 0.125227

312 0.000000 0.015706 0.005237 0.000000 0.021771

313 0.000000 0.002683 -0.071846 0.000000 -0.044026

314 0.000000 0.012780 0.058461 0.000000 -0.003922

315 0.117783 -0.041042 0.051582 0.095310 -0.005911

316 -0.057158 -0.121788 -0.018451 -0.095310 0.004929

317 0.000000 -0.020762 -0.022600 0.000000 -0.060809

318 -0.060625 -0.014085 0.055570 -0.105361 0.022728

319 -0.064539 -0.007117 -0.045148 0.000000 -0.045985

320 -0.068993 -0.019673 0.036098 0.000000 -0.009672

321 -0.074108 -0.037104 0.048357 0.000000 0.055657

322 0.000000 0.021755 0.014191 0.000000 -0.011300

323 0.000000 0.019315 -0.030345 0.000000 -0.007258

324 -0.080043 -0.048658 -0.046855 0.000000 -0.006263

325 0.000000 -0.038113 -0.026643 -0.117783 -0.042787

326 0.080043 0.054597 0.092680 0.117783 0.022691

327 0.000000 0.008141 -0.017422 -0.117783 0.009569

328 -0.080043 0.010084 0.088658 0.000000 -0.007435

329 0.000000 -0.030563 0.037100 0.117783 0.035606


Dish TV Infosys Hindustan Unilever Vodafone Idea Cipla

330 -0.087011 0.020479 0.024872 0.000000 0.004107

331 0.000000 0.055205 -0.003028 0.000000 0.014242

332 0.000000 0.033326 0.002650 0.000000 0.045417

333 0.000000 -0.014326 -0.019085 0.000000 -0.008725

334 0.087011 -0.005031 0.020218 0.000000 -0.010769

335 0.000000 -0.076633 -0.037711 0.000000 -0.015873

336 0.154151 -0.012329 0.018264 0.000000 0.011929

337 0.194156 0.050397 -0.002313 0.105361 0.044452

338 -0.060625 -0.091908 -0.023429 -0.105361 -0.013321

339 0.171850 -0.023257 0.052715 0.000000 0.020854

340 -0.054067 0.037522 0.020405 0.000000 0.046733

341 0.000000 0.009866 -0.057828 0.000000 -0.006287

342 -0.057158 0.035140 0.001555 -0.117783 -0.001803

343 0.000000 0.027381 0.013889 0.117783 0.033721

344 -0.060625 0.007874 -0.025220 0.000000 0.013004

345 0.000000 -0.005900 -0.005516 -0.117783 -0.013004

346 0.000000 0.034887 -0.009528 0.117783 -0.019384

347 0.000000 0.004435 -0.009217 -0.117783 -0.017048

348 0.271934 0.028662 0.017163 0.000000 -0.004535

349 0.090972 0.006124 0.028479 0.000000 0.012647

350 -0.044452 -0.055221 0.038481 0.000000 -0.008112

351 -0.095310 -0.027471 -0.011539 0.000000 -0.013668

352 -0.162519 -0.005319 -0.018897 0.000000 0.033382

353 0.057158 0.009290 -0.018095 0.000000 -0.042598

354 0.000000 -0.044572 0.005811 0.000000 0.001850

355 0.000000 0.041926 0.014951 -0.133531 -0.011153

356 0.000000 0.016421 -0.026216 0.000000 -0.016015

357 -0.117783 -0.003916 0.019343 -0.154151 0.003791

358 -0.064539 0.044139 0.008014 0.287682 -0.035632

359 -0.068993 -0.000626 -0.027357 0.000000 0.015565

360 0.000000 -0.007542 -0.016542 -0.133531 -0.037369

361 0.000000 -0.028802 -0.012388 0.000000 -0.032589

362 0.068993 -0.029656 -0.002012 0.000000 -0.087576


Dish TV Infosys Hindustan Unilever Vodafone Idea Cipla

363 0.064539 -0.020954 -0.006467 0.000000 -0.002262

364 -0.064539 -0.030516 -0.007735 -0.154151 -0.010245

365 -0.068993 -0.024235 0.015410 0.000000 0.007977

366 -0.074108 0.034743 0.033633 0.000000 0.032387

367 0.000000 -0.007695 -0.001947 0.000000 -0.014389

368 0.000000 -0.130326 0.003114 0.000000 0.019868

369 0.207639 -0.017757 -0.027982 0.000000 0.001092

370 0.000000 0.020154 -0.018149 0.154151 -0.008772

371 0.000000 0.007157 0.019747 0.000000 0.020709

372 -0.064539 -0.009554 0.051333 0.000000 0.013926

373 0.000000 0.018233 -0.001138 0.000000 -0.025864

374 -0.068993 0.046056 0.013195 0.000000 0.038549

375 0.000000 -0.021996 0.017082 0.000000 0.018731

376 0.000000 -0.023275 -0.026489 0.000000 0.003088

377 0.000000 0.015577 0.021321 0.133531 0.033353

378 0.068993 -0.018721 -0.022456 0.000000 -0.017043

379 0.000000 0.046162 0.016889 0.000000 0.030864

380 0.182322 0.005249 0.008523 0.000000 0.003914

381 0.105361 0.064445 -0.014870 -0.133531 0.011651

382 -0.051293 -0.061458 -0.025030 0.133531 0.012470

383 -0.054067 0.005948 -0.011199 0.000000 0.119371

384 0.000000 0.028500 -0.013685 0.000000 0.010938

385 0.105361 -0.011594 -0.015074 0.000000 0.044997

386 -0.051293 0.013034 0.020962 0.000000 -0.010454

387 0.000000 0.021353 0.003906 0.117783 -0.020417

388 -0.054067 0.016067 -0.020083 0.105361 0.030872

389 0.154151 0.018538 0.000000 0.095310 -0.004008

390 -0.048790 0.023530 -0.017252 0.087011 -0.003218

391 -0.105361 -0.010017 0.004442 -0.087011 -0.045331

392 0.000000 -0.037611 -0.006467 0.087011 0.000000

393 0.000000 0.020690 0.007675 -0.087011 -0.023029

394 0.000000 -0.022783 0.029735 0.087011 0.006022

395 0.000000 -0.004199 -0.026119 0.000000 0.028742


Dish TV Infosys Hindustan Unilever Vodafone Idea Cipla

396 -0.057158 -0.032790 -0.009265 -0.087011 -0.011735

397 0.000000 0.010094 0.017650 0.241162 0.021686

398 0.057158 -0.010094 -0.015225 0.000000 0.025256

399 0.105361 0.043948 0.022751 0.068993 -0.000805

400 0.000000 -0.003473 -0.007526 -0.143101 -0.035235

401 -0.051293 0.015879 0.024353 0.000000 0.010784

402 0.000000 0.020340 -0.021574 0.000000 0.004938

403 0.100083 0.051025 -0.000793 0.074108 -0.009901

404 -0.048790 -0.003194 0.021979 0.000000 0.024571

405 -0.105361 -0.015474 0.033591 0.133531 0.012862

406 0.200671 -0.006519 -0.014748 0.060625 0.035312

407 0.044452 0.073126 -0.030557 -0.060625 0.014543

408 -0.139762 0.008475 0.007435 -0.064539 0.009077

409 -0.051293 0.003610 -0.062332 0.000000 0.027480

410 0.051293 0.017858 0.022159 -0.068993 0.026032

411 0.048790 -0.014859 -0.016367 0.133531 0.027457

412 0.133531 0.020741 -0.014126 0.000000 0.003466

413 0.000000 -0.017752 0.000418 0.117783 0.019870

414 -0.087011 -0.010201 0.010402 -0.182322 0.006087

415 -0.095310 -0.030621 -0.002902 -0.068993 0.006720

416 -0.105361 0.013589 -0.037214 -0.074108 -0.002683

417 0.000000 -0.077133 -0.027962 0.000000 -0.005387

Inference -CIPLA gives the Highest returns

Average Returns
In [ ]: StockMeans = Return_of_Stocks.mean() ## Complete the code to get the mean f
StockMeans.sort_values()
Out[ ]: 0

Vodafone Idea -0.003932

Dish TV -0.003751

Infosys 0.002180

Hindustan Unilever 0.002294

Cipla 0.002538

dtype: float64

Inference

as mentioned earlier the dips are more at the same the returns are more
with Hindustan uni lever , CIpla and Infosys.

Volatility
In [ ]: StockStdDev = Return_of_Stocks.std() ## Complete the code to get the std. d
StockStdDev.sort_values()

Out[ ]: 0

Hindustan Unilever 0.028845

Infosys 0.036102

Cipla 0.036759

Dish TV 0.091333

Vodafone Idea 0.113747

dtype: float64

Inference

-The deviations are High in Vodafone Idea.

Visualizing Returns and Volatility


In [ ]: data = pd.DataFrame({'StockMeans': StockMeans}) ## Create a DataFrame using
data
Out[ ]: StockMeans

Dish TV -0.003751

Infosys 0.002180

Hindustan Unilever 0.002294

Vodafone Idea -0.003932

Cipla 0.002538

In [ ]: data = pd.DataFrame({'StockStdDev': StockStdDev}) # Create a DataFrame usin


data

Out[ ]: StockStdDev

Dish TV 0.091333

Infosys 0.036102

Hindustan Unilever 0.028845

Vodafone Idea 0.113747

Cipla 0.036759

In [ ]: fig = plt.figure(figsize=(10,6))
ax = fig.add_subplot(111)

# Create a DataFrame with both StockMeans and StockStdDev


data = pd.DataFrame({'StockMeans': StockMeans, 'StockStdDev': StockStdDev})

plt.scatter(data['StockStdDev'], data['StockMeans']) # Plot 'StockStdDev' v

plt.axhline(y=0,linestyle='--', color = "red")

for index, row in data.iterrows():


ax.text(row['StockStdDev'], row['StockMeans'], index)

plt.xlabel('Volatility')
plt.ylabel('Net returns')
plt.title('Net return vs Volatility for stocks')
plt.grid()
plt.show()
Inference

The volatility is high in Dish TV and Vodafone Idea.


The Returns are less in Dish TV and Vodafone Idea.
The Volatility is less with Hindustan Unilever, Idea and CIpla, But returns are
High.

Conclusions and Recommendations


Discussed ABout Stocks Cipla, Hindustan Lever, Vodafone Idea, Infosys, Dish
TV.
Vodafone Idea and Dish Tv Satrted with Good value and better demand.
Cipla,Infosys, Hindustan lever Started With a value and gradually Increased
teh Stock price.
Even the Voltality is High with Cipla , Hindustan Lever, Infosys best retuns
are provide on Long time.
Vodafone Idea

This notebook was converted to PDF with convert.ploomber.io

You might also like