Short selling, volatility and bubbles

October 17, 2011
By

(This article was first published on Freakonometrics - Tag - R-english, and kindly contributed to R-bloggers)

Yesterday, I wrote a post (in French) about short-selling in financial market since some journalists claimed that it was well-known that short -selling does increase volatility on financial market. Not only in French speaking journals actually, since we can read on http://www.forbes.com that  « in a market with restrictions on short-selling, volatility is reduced ». But things are not that simple. For instance http://www.optionsatoz.com/ explains it from a theoretical point of view. But we can also look at the data. For instance, we can compare the stock price of Air China,
exchanged in Shanghai in blue (where short-selling is forbidden) and in Hong Kong in rouge (where short-selling is allowed), since @Igor gave me the tickers of those stocks

library(tseries)X<-get.hist.quote("0753.HK")Y<-get.hist.quote("601111.SS")plot(Y[,4],col="blue",ylim=c(0,30))lines(X[,4],col="red")

But as @alea_ pointed out, one asset is expressed here in Yuans renminbi, and the other one in HK dollars. So I downloaded the exchange rate from http://www.oanda.com/

Z=read.table("http://freakonometrics.blog.free.fr/public/data/change-cny-hkd.csv",header=TRUE,sep=";",dec=",")D=as.Date(as.character(Z$date),"%d/%m/%y")z=as.numeric(Z$CNY.HKD)plot(D,z,type="l")X2=X[,4]for(t in 1:length(X2)){
X2[t]=X2[t]*z[D==time(X2[t])]} X2=X[,4]plot(Y[,4],col="blue",ylim=c(0,30))lines(X2,col="red")

Now both stocks are expressed in the same currency. To compare returns volatility, a first idea can be to use GARCH models,

RX=diff(log(X2))RY=diff(log(Y[,4]))Xgarch = garch(as.numeric(RX))SIGMAX=predict(Xgarch)Ygarch = garch(as.numeric(RY))SIGMAY=predict(Ygarch)plot(time(Y)[-1],SIGMAY[,1],col="blue",type="l")lines(time(X2)[-1],SIGMAX[,1],col="red")

But volatility is here too eratic. So an alternative can be to use exponentially-weighted moving averages, where simple recursive relationships are considered

http://i2.wp.com/perso.univ-rennes1.fr/arthur.charpentier/latex/vol-04.png?w=456

or equivalently

http://i0.wp.com/perso.univ-rennes1.fr/arthur.charpentier/latex/vol-05.png?w=456

The code is not great, but it is easy to understand,

moy.ew=function(x,r){ m=rep(NA,length(x))for(i in 1:length(x)){ 
m[i]=weighted.mean(x[1:i],          rev(r^(0:(i-1))))}
    return(m)} 
sd.ew=function(x,r,m){sd=rep(NA,length(x))for(i in 1:length(x)){  sd[i]=weighted.mean((x[1:i]-m[i])^2,          rev(r^(0:(i-1))))}return(sd)} q=.97MX=moy.ew(RX,q)SX=sd.ew(RX,q,MX)MY=moy.ew(RY,q)SY=sd.ew(RY,q,MY)plot(time(Y)[-1],SY,col="blue",type="l")lines(time(X2)[-1],SX,col="red")

And now we have something less erratic, so we can focus now on the interpretation.
It is also possible to look on the difference between those two series of volatility, areas in blue means that in Shanghai (again, where short-selling is forbidden) returns are more volatile than in Hong Kong, and areas in redare periods where returns are more volatile in Hong Kong,

a=time(X2)[which(time(X2)%in%time(Y))]b=SY[which(time(Y)%in%time(X2))]-  SX[which(time(X2)%in%time(Y))]n=length(a)a=a[-n];b=b[-n]plot(a,b,col="black",type="l")polygon(c(a,rev(a)),c(pmax(b,0),rep(0,length(a))),        col="blue",border=NA)polygon(c(a,rev(a)),c(pmin(b,0),rep(0,length(a))),        col="red",border=NA)

So clearly, there is nothing clear that can be said… Sometimes, volatility is higher in Hong Kong, and sometimes, it is higher in Shanghai. But if we look at the price, instead of looking at volatility,

a=time(X2)[which(time(X2)%in%time(Y))]b=as.numeric(Y[which(time(Y)%in%time(X2)),4])- as.numeric(X2[which(time(X2)%in%time(Y))])n=length(a)a=a[-n];b=b[-n]plot(a,b,col="black",type="l")polygon(c(a,rev(a)),c(pmax(b,0),rep(0,length(a))),  col="blue",border=NA)polygon(c(a,rev(a)),c(pmin(b,0),rep(0,length(a))),  col="red",border=NA)

Here, it looks like bans on short-selling creates bubbles. Might not not be a good thing.

To leave a comment for the author, please follow the link and comment on their blog: Freakonometrics - Tag - R-english.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: , , , , , , , , ,

Comments are closed.

Recent popular posts

Sponsors

Mango solutions



RStudio homepage



Zero Inflated Models and Generalized Linear Mixed Models with R

Dommino data lab

Quantide: statistical consulting and training



http://www.eoda.de







ODSC

ODSC

CRC R books series





Six Sigma Online Training





Contact us if you wish to help support R-bloggers, and place your banner here.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)