Policy changes have a significant impact on financial markets. In this study, we build and calibrate a heterogeneous-agent model of a complex network using real data, then empirically examine the effects of policy changes on the risk contagion mechanism in the Chinese bond market. We find that the externality of diversification is positive, that is, a diversified portfolio can reduce the adverse effects of a negative shock, however, the positive externality weakened after the break of implicit government guarantee. Our findings show that policy changes influence the market through price co-movement and diversified portfolios. Moreover, the externality of diversification and the effect of policy changes vary between government and corporate bonds. Finally, investment strategies are proposed based on the findings.