Showing posts with label Chartseries HINDUNILVR. Show all posts
Showing posts with label Chartseries HINDUNILVR. Show all posts

Friday, December 6, 2019

Chartseries HINDUNILVR

 "Stock Price HINDUNILVR.NS"

> chartSeries(Cl(HINDUNILVR.NS))
> addMACD()
> addRSI()
> addBBands()
Stock Price HINDUNILVR

> ret <- dailyReturn(Cl(HINDUNILVR.NS), type='log')
Warning message:
In to_period(xx, period = on.opts[[period]], ...) :
  missing values removed from data
> par(mfrow=c(2,2))
> acf(ret, main="HINDUNILVR Return ACF");
> pacf(ret, main="HINDUNILVR Return PACF");
> acf(ret^2, main="HINDUNILVR Squared return ACF");
> pacf(ret^2, main="HINDUNILVR Squared return PACF")
Stock Price HINDUNILVR

Stock Price HINDUNILVR

Stock Price HINDUNILVR

> par(mfrow=c(1,1))
> m=mean(ret);s=sd(ret);
> par(mfrow=c(1,2))
> hist(ret, nclass=40, freq=FALSE, main='HINDUNILVR Return histogram');curve(dnorm(x,mean=m,sd=s), from = -0.3, to = 0.2, add=TRUE, col="red")
> plot(density(ret), main='HINDUNILVR Return empirical distribution');curve(dnorm(x,mean=m,sd=s), from = -0.3, to = 0.2, add=TRUE, col="red")
> par(mfrow=c(1,1))
> kurtosis(ret)
[1] 5.969741
attr(,"method")
[1] "excess"
> plot(density(ret), main='HINDUNILVR Return EDF - upper tail', xlim = c(0.1, 0.2),
+      ylim=c(0,2));
> curve(dnorm(x, mean=m,sd=s), from = -0.3, to = 0.2, add=TRUE, col="red")
> plot(density(ret), xlim=c(-5*s,5*s),log='y', main='HINDUNILVR Density on log-scale')
Warning message:
In xy.coords(x, y, xlabel, ylabel, log) :
  26 y values <= 0 omitted from logarithmic plot
> curve(dnorm(x, mean=m,sd=s), from=-5*s, to=5*s, log="y", add=TRUE,
+       col="red")
> qqnorm(ret);qqline(ret);
Stock Price HINDUNILVR

Stock Price HINDUNILVR

Stock Price HINDUNILVR

> ret.HINDUNILVR <- dailyReturn(Cl(HINDUNILVR.NS), type='log')
> chartSeries(ret.HINDUNILVR)
> garch11.spec = ugarchspec(variance.model = list(model="sGARCH",garchOrder=c(1,1)), mean.model = list(armaOrder=c(0,0)))
> hindunilvr.garch11.fit = ugarchfit(spec=garch11.spec, data=ret.HINDUNILVR)
> coef(hindunilvr.garch11.fit)
          mu        omega       alpha1
6.922784e-04 4.208057e-05 1.447667e-01
       beta1
7.169626e-01
> vcov(hindunilv.garch11.fit)
Error in vcov(hindunilv.garch11.fit) :
  object 'hindunilv.garch11.fit' not found
> vcov(hindunilvr.garch11.fit)
              [,1]          [,2]          [,3]
[1,]  6.112490e-08 -1.132356e-10 -1.016053e-07
[2,] -1.132356e-10  7.558056e-11  1.299447e-07
[3,] -1.016053e-07  1.299447e-07  3.988629e-04
[4,]  4.894170e-07 -3.781590e-07 -7.747107e-04
              [,4]
[1,]  4.894170e-07
[2,] -3.781590e-07
[3,] -7.747107e-04
[4,]  2.016492e-03
> infocriteria(hindunilvr.garch11.fit)
                   
Akaike       -5.371017
Bayes        -5.364620
Shibata      -5.371020
Hannan-Quinn -5.368747
> uncmean(hindunilvr.garch11.fit)
[1] 0.0006922784
> uncvariance(hindunilvr.garch11.fit)
[1] 0.0003043347
 signbias(hindunilvr.garch11.fit) 
                     t-value      prob sig
Sign Bias          1.6159587 0.1061838 
Negative Sign Bias 0.5679904 0.5700740 
Positive Sign Bias 1.0562914 0.2909002 
Joint Effect       5.2640438 0.1534526 

Black-Scholes formula-R

 Black-Scholes formula-R > BlackScholes <- function(TypeFlag = c("c", "p"), S, X, Time, r, b, sigma) { TypeFla...