Model risk exposed to assumptions

Overview

in the previois artical,we made several strong assumptions based on Market Micro Structure theories. However, those are very strong assumption and some are adapted for easy mathamatical calculation. More practically,we found that the assumption of Buy and Sell trades follow a binomial distribution is not correct. In real market trading, especially in China where retail investors are of huge ratio, the clustering effect of trades is a normal phenomenon,which means that buy trade is more likely to lead to buy trade and sell trade is more likely to lead to sell trade. So instead of modelling this effect with a long memory process and use \(corr(S_i,S_j)=\rho^{|i-j|}\),we could just try a markov chain model. The probability of transition from state to state is different depending on which state you are at.

#load dataset
mt_quote<-readRDS("mt_quote.RDS") 
mt_trade<-readRDS("mt_trade.RDS")

The data cleansing process are just the same as the previous article,thus omited here.

Fit a markov chain using the package “markovchain”.

library(markovchain)
BS.chain<-markovchainFit(data = norm.mt.trade$BS,method = "mle",byrow = T)
BS.chain$estimate@transitionMatrix
##           B         S
## B 0.7771708 0.2228292
## S 0.2157858 0.7842142

There we go! This transition matrix clearly elaborates more about how the “herding” effect took place. If a current state is \(Buy\),the next step would more like to transit to \(Buy\) itself, with a probability of 0.7771708,and if a current state is \(Sell\),the next step would more like to transit to \(Sell\) itself, with a probability of 0.7842142.
One might have notices that Sell has a larger probability of transit to itself than Buy,(0.7842142>0.7771708), this is because of the fear caused by market plummeting and the crowded fire sell that without much rationality in a downward market.
The transition precoss can be visualized as followes.

statesNames=c("Buy","Sell")
markovBS<-new("markovchain", states=statesNames, transitionMatrix=
          matrix(c(0.7771708,0.2228292,
                   0.2157858,0.7842142),nrow=2, byrow=TRUE, dimnames=list(statesNames,statesNames)
                 ))
plot(markovBS)

Apply to sub-sessions

transit.sep<-lapply(sep.norm,function(y){ 
  t<-markovchainFit(data = y$BS,method = "mle",byrow = T)
  t$estimate@transitionMatrix
  }
)
buy.trans<-lapply(transit.sep,function(y) y[1,])
buy.trans<-data.frame(t(data.frame(buy.trans)))
sell.trans<-lapply(transit.sep,function(y) y[2,])
sell.trans<-data.frame(t(data.frame(sell.trans)))
trans.all<-cbind(buy.trans,sell.trans)
names(trans.all)<-c("B2B","B2S","S2B","S2S")
par(mfrow=c(2,2))
plot(trans.all$B2B,xlab="session",ylab="prob",main="B to B",pch=20,col="red3")
plot(trans.all$B2S,xlab="session",ylab="prob",main="B to S",pch=20,col="orange")
plot(trans.all$S2B,xlab="session",ylab="prob",main="S to B",pch=20,col="blue3")
plot(trans.all$S2S,xlab="session",ylab="prob",main="S to S",pch=20,col="green3")

Each two of the plots are symmetic. The prob of a buy trade transmit to itself goes down during the day, though still greater than 0.5,but it indicates that more prob of a buy switching to sell when the time goes buy, maybe because people who hold the stock from \(T-1\) has waited until afternoon to clear out their gain. Before market close,the prob rises again,majorly reason would be unfinished trading schedule or sudden realize and herding of retial investers.

The prob of a sell trade transmit to itself exhibits a similar downward trend as the B to B, only difference is that Before market close,there is no sudden jump of S to S.

Though the transition of buy and sell is visulized,but more meaningfull discoverys still require more delicate analysis. For example,relate the transition matrix to specific events,like plummeting,market collapse and bullish trend,under that circumstance,can we inspect deeply how the transition varies.Much work still remains to be down.