  Margin trading in which investors purchase shares with money borrowed from
brokers is blamed to be a major cause of the 2015 Chinese stock market crash.
We propose a cascading failure model and examine how an increase in margin
trading increases share price vulnerability. The model is based on a bipartite
graph of investors and shares that includes four margin trading factors, (i)
initial margin $k$, (ii) minimum maintenance $r$, (iii) volatility $v$, and
(iv) diversity $s$. We use our model to simulate margin trading and observe how
the share prices are affected by these four factors. The experimental results
indicate that a stock market can be either vulnerable or stable. A stock market
is vulnerable when an external shock can cause a cascading failure of its share
prices. It is stable when its share prices are resilient to external shocks.
Furthermore, we investigate how the cascading failure of share price is
affected by these four factors, and find that by increasing $v$ and $r$ or
decreasing $k$ we increase the probability that the stock market will
experience a phase transition from stable to vulnerable. It is also found that
increasing $s$ decreases resilience and increases systematic risk. These
findings could be useful to regulators supervising margin trading activities.
