Showing posts with label stock price of infosys. Show all posts
Showing posts with label stock price of infosys. Show all posts

The stock price of Infosys -R

"INFY.NS"
> chartSeries(Cl(INFY.NS))

> infyret <- dailyReturn(Cl(INFY.NS), type='log')
> par(mfrow=c(2,2))
> acf(infyret, main="Return ACF");
> pacf(infyret, main="Return PACF");
> acf(infyret^2, main="Squared return ACF");
> pacf(infyret^2, main="Squared return PACF")

> par(mfrow=c(1,1))
> m=mean(infyret);s=sd(ret);
> par(mfrow=c(1,2))
> hist(infyret, nclass=40, freq=FALSE, main='Return histogram');curve(dnorm(x,mean=m,sd=s), from = -0.3, to = 0.2, add=TRUE, col="red")

> plot(density(infyret), main='Return empirical distribution');curve(dnorm(x,mean=m,sd=s), from = -0.3, to = 0.2, add=TRUE, col="red")

> kurtosis(infyret)
daily.returns
307.8082
> plot(density(infyret), main='Return EDF - upper tail', xlim = c(0.1, 0.2),ylim=c(0,2));
> qqnorm(infyret)
> qqline(infyret);
conclusion
> chartSeries(infyret)

> garch11.spec = ugarchspec(variance.model = list(model="sGARCH",
+ garchOrder=c(1,1)), mean.model = list(armaOrder=c(0,0)))
> infy.garch11.fit = ugarchfit(spec=garch11.spec, data=infyret)

Black-Scholes formula-R

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