(Bloomberg Opinion) — Nov. 3 was a sad, sad day for China. Not because America’s election changes anything about its hawkish stance toward Beijing — that’s bipartisan — but because China lost a golden investment opportunity by shooting itself in the foot. Looking purely at the numbers, China is in a sweet spot right now. Its bonds are attractive, as the yield differential with U.S. Treasuries hovers near a five-year high. Beijing’s virus-containment strategy is working, and the economy has bounced back. Meanwhile, President Xi Jinping’s latest five-year economic blueprint, which favors innovation and domestic consumption, is a win for tech companies — exactly the kind of growth stocks investors love. Foreigners have been buying the China story this year, even as President Donald Trump threatened to sanction and delist mainland companies. They are crowding into Beijing’s sovereign issues at a record pace, promising to overtake domestic city commercial banks as the second largest purchasing bloc. Global investors need to have “a significant portion” of their portfolios in Chinese assets, both for diversification and short-term tactical gains, said Bridgewater Associates LP founder Ray Dalio. (Dalio says as he understands it, events were progressing faster than regulators were comfortable with, which led to their actions. “So I assure you that Chinese regulators’ move to curtail Ma’s IPO was not my worst nightmare, and I certainly do not believe that it will have any notable effect on the evolution of China and its markets.” To read his full statement, click here.)The Shanghai Stock Exchange’s surprise suspension of Ant Group’s record-breaking initial public offering Tuesday night changed the landscape entirely. Two weeks earlier, the company’s billionaire founder Jack Ma made a sensational speech, saying China’s financial system and regulatory framework are broken. On Monday, Beijing’s top financial watchdogs summoned Ma and dressed him down. Then they issued new draft rules to rein in Ant’s lucrative consumer loan business. It’s episodes like this that remind us how capricious and thin-skinned Beijing’s policy makers can be. Regulators have been debating whether to allow online microlenders to act as simple matchmakers (rather than traditional lenders, which require capital buffers), for a good two years. Why the sudden change of heart two days before Ant’s much-anticipated trading debut? The fintech giant had already raised at least $34.5 billion from its dual listing in Hong Kong and Shanghai. Now, it has to return billions of dollars to its IPO subscribers. Somehow, Beijing has proved Ma’s point: China’s bureaucrats don’t know what they’re doing. To govern well, you can’t pick and choose when and how hard to regulate; the secret sauce is consistency. Beijing is looking as childish and moody as Trump on the day of the U.S. election. While Jack Ma’s botched IPO is the big story, there are plenty of obscure examples that also matter to long-term investors. Consider instead the so-called keepwell clause. This “gentlemen’s agreement” is a common feature of China’s $790 billion dollar bond market, and in theory protects investors in the event of default. In September, a Beijing court rejected the recognition of the keepwell deed for a conglomerate’s dollar bond. Two months later, a court in Shanghai ruled to accept this provision for an energy trader. China’s stance on keepwell is anyone’s guess. This is the problem with investing in China. First, assumed rules can be broken at whim, especially when policy makers fear they are losing face. Second, after Ma’s troubles, what billionaire executive will want to speak up? It’s much better to be supplicant, keep quiet and busy yourself making money. Sure, China has many attractive traits, but you’d better be prepared to stay in perpetual crisis mode. This column does not necessarily reflect the opinion of the editorial board or Bloomberg LP and its owners.Shuli Ren is a Bloomberg Opinion columnist covering Asian markets. She previously wrote on markets for Barron’s, following a career as an investment banker, and is a CFA charterholder.For more articles like this, please visit us at bloomberg.com/opinionSubscribe now to stay ahead with the most trusted business news source.©2020 Bloomberg L.P.