Buttonwood

How machine learning is revolutionising market intelligence

The business of gathering market-sensitive information is ripe for automation



The thames seems to draw people who work on intelligence-gathering. The spooks of mi6 are housed in a funky-looking building overlooking the river. Two miles downstream, in a shared office space near Blackfriars Bridge, lives Arkera, a firm that uses machine-learning technology to sort intelligence from newspapers, websites and other public sources for emerging-market investors. Its location is happenstance. London has the right time zone, between the Americas and Asia. It is a nice place to live. The Thames happens to run through it.

Arkera’s founders, Nav Gupta and Vinit Sahni, both have a background in “macro” hedge funds, the sort that like to bet on big moves in currencies and bond and stock prices ahead of predicted changes in the political climate. 

The firm’s clients might want a steer on the political risks affecting public finances in Brazil, or to gauge the social pressures that could arise as a consequence of an austerity programme in Egypt. It applies machine learning to find market intelligence and make it usable.

For many people, the use of such technologies in finance is the stuff of dystopian science fiction, of machines running amok. But once you look at market intelligence through the eyes of computer science, it provokes disquieting thoughts of a different kind. It gives a sense of just how creaky and haphazard the old-school, analogue business of intelligence-gathering has been.

Analysts have used text data to try to predict changes in asset prices for a century or more. In 1933 Alfred Cowles, an economist whose grandfather had founded the Chicago Tribune, published a pioneering paper in this vein. Cowles sorted stockmarket commentary by William Peter Hamilton, a long-ruling editor of the Wall Street Journal, into three buckets (bullish, bearish or doubtful) and attached an action to each (buy, sell or avoid). 

He concluded that investors would have done better simply to buy and hold the leading stocks in the Dow Jones index than to follow Hamilton’s steer.

The application of machine-learning models to text-as-data might seem a world away from Cowles’s approach. But in concept, it is similar. The relevant text is sought. Values are ascribed to it. 

A statistical model is applied. Its predictions are tested for robustness. Of course, with bags of computing power and suites of self-learning models, the enterprise is on a different scale from Cowles’s rudimentary exercise. 

The endless expanse of the internet means far richer source material. The range of possible values ascribed to it will be broader than “bullish, bearish or doubtful”. And self-learning algorithms can test and retest the combinations that yield the best predictions.

It is tempting to focus on the black-box elements of all this: the language software that “reads” the source text and the algorithms that use the data to make predictions. But this is like judging a hi-fi system by its speakers. A lot of the important work comes earlier in the process. 

Arkera, for instance, spends a lot of effort finding all the relevant text and “cleaning” it—stripping it of extraneous junk, such as captions and disclaimers. “A good signal is crucial,” says Mr Gupta.

He gives Brazil’s pension reform as an example. The country has 513 parliamentarians. They have social-media accounts, websites and blogs. They speak to the press—Brazil has scores of regional newspapers. All are potential sources of useful data. 

If you cut corners at this stage you might miss something that even the best statistical model cannot fix later. There is little point in having a cool amplifier and great speakers if the stylus on your record-player is worn out.

Any good emerging-market analyst knows this, too. If you bumped into one shortly after Brazil’s elections last year, he was probably on his way to Brasília to sound out prospects for a crucial pension reform. Without it, Brazil’s public debt would be certain to explode, sparking capital flight. 

In July a pension bill finally passed Brazil’s lower house. Arkera’s models tracked the leanings of Brazil’s politicians to get an early sense of the likely outcome. It would be hard for an analyst working unaided to mimic this reach, even if he was always on the ground and spoke perfect Portuguese.

Intelligence-gathering is a labour-intensive business. It is thus ripe for automation. That this is happening in finance is also natural. There is a well-defined objective (to make money). There is a well-defined end-point (buy, sell or avoid). 

Without such clarity of purpose, intelligence is an endless river. 

It is one undammed thing after another.

Gold is looking more and more attractive

Rising US liabilities for entitlements could undermine the dollar

Rana Foroohar

Gold Investor / Prospector
© Matt Kenyon


Gold bugs have always struck me as paranoid. You have to really believe the sky is falling in order to hoard physical bars in a digital age. So, it’s rather worrying that some investors and central bankers are talking up gold.

The Dutch Central Bank recently argued in an article that if there were to be a major monetary reset, “gold stock can serve as a basis” to rebuild the global monetary system. “Gold bolsters confidence in the stability of the central bank’s balance sheet and creates a sense of security.”

Talk of gold, however, does not. Investor Ray Dalio recently spooked attendees at the Institute for International Finance conference when he mentioned the possibility of a flight to gold because of his concerns about America’s fiscal position.

That is not a new point. Since at least 2016, financial titans including JPMorgan chief Jamie Dimon and hedge fund manager Stanley Druckenmiller have pointed out that unfunded pension and healthcare entitlements are a looming iceberg for the US economy. Indeed, one theory about the recent crisis in the “repo” overnight lending market is that it was caused by the federal deficit and the increasing unwillingness of investors outside the US to fund it.

But Mr Dalio went further, concluding that the American entitlement crisis meant the US Federal Reserve would have to continue to inflate its own balance sheet indefinitely, and keep rates low (or even negative) well into the future so the US could keep paying its bills.

That would depreciate the US dollar. Taken to its extreme, that never ends well. Prior experiments with rapidly falling currencies include late-third century Rome, Germany’s interwar Weimar Republic and Zimbabwe. At some point, Mr Dalio argued, nobody would want to own US debt or the dollar, and investors would look to other assets for safety. “The question is, what else?” he asked. “That’s the environment I think that we’ll be in. And there’s a saying that gold is the only asset you can have that’s not somebody else’s liability.”

I haven’t bought any gold yet myself, though I did sell out of equities entirely in August. That decision has been somewhat painful given the recent upsurge in the S&P 500, and yet it is one that I do not regret. There is logic in believing — as I do — that US blue-chips and bonds are no longer a safe haven while also believing that prices could stay high for some time to come. After all, holding two seemingly contradictory thoughts in your head at once is the sign of a mature mind. I believe US stock prices are staying up for precisely the same reason that investors might need to be in gold someday.

Analyst Luke Gromen laid out the mathematical logic of this very well in a recent newsletter. He calculates that US annual entitlement payments, which he defines as Medicare, Medicaid and Social Security, plus defence spending plus interest on the federal debt adds up to 112 per cent of US federal tax receipts.

That total has risen from 103 per cent only 15 months ago and 95 per cent two years ago, as government revenue fell due to President Donald Trump’s tax cuts. The proceeds of those cuts helped to further inflate equity prices. The US has become “utterly dependent on asset price inflation for tax receipts”, Mr Gromen writes, adding that the only way the US will be able pay its yearly bills is for asset prices to climb on their own, or for the Fed to “print enough money to make asset prices rise”.

I expect the Fed will, like every central bank before it, do what is politically required. Neither the US nor the world can afford for America to nominally default on its Treasury bills. So, stock prices will rise — for now. The essence of economic policy is, as Joseph Schumpeter reportedly put it, “politics, politics, politics”.

Share price inflation has been under way since the Fed switched gears and began lowering rates in July. It will probably be helped along by the easing of financial regulations enacted after the 2008 crisis, and possibly even a new round of tax cuts before the 2020 elections. Mr Trump measures his own success by that of the market.

But in the longer run, this financially engineered growth must erode confidence in the dollar, particularly at a time when the US and China are going in different directions. China is now the world’s largest natural gas buyer, and is looking to start setting prices for this and other commodities in its own currency. China is also doing more business in euros, as it tries to woo Europe into its own economic orbit. China recently issued its first euro-denominated bonds in 15 years. It is also moving away from buying oil in dollars and strengthening ties with EU companies such as Airbus.

The de-dollarisation of Eurasia would support Mr Dalio’s worldview. So would a shift to a non-dollar reserve asset such as gold. Such a change would force the US to sell dollars in order to settle its balance of payments in the new, neutral reserve asset.

One could argue that even if the US dollar were to weaken and creditors to lose faith in America’s ability to repay its debt, markets might still remain high for a period of time.

But we are undergoing a period of deglobalisation.

And history shows that when that happens, it eventually tends to trigger asset price collapses in whatever country is associated with the “old order”.

No wonder gold bugs abound.

China’s Disappearing Data: The Saga Continues

Official statistics suggest small-business lending—a crucial ingredient for growth—is booming. The truth is less rosy, but not as dire as it was.

By Nathaniel Taplin


Staff members work in an e-commerce company in Yiwu, east China, last year. Photo: Tan Jin/Zuma Press


How are small businesses, the engine of China’s spectacular rise over the past 30 years, doing these days? The answer depends on which regulator you ask—and which data set you believe.

Last year’s credit crunch for Chinese entrepreneurs—a side effect of a brutal crackdown on shadow banking—had by early 2019 become bad enough to seriously alarm China’s leadership.

Irate officials told China’s biggest banks to boost small-business loans by a massive 30% in 2019. Lo and behold, this goal is set to be handily beaten. Outstanding small-business loans from China’s five biggest banks were up 48% from 2018 levels in September, according to China’s banking regulator.


But this doesn’t tell investors the full story.

Official data has always given a better read on large, state-owned firms than small, private ones. Recently, though, eyeballing China’s private sector has gotten even harder. The People’s Bank of China hasn’t updated its breakdown of loans by ownership (state, private, foreign-owned) since 2016—although the data clearly still exists, notes research consultancy Gavekal Dragonomics, since officials occasionally cite figures piecemeal.

In 2018, the central bank also stopped publishing its longstanding series on small-business lending, replacing it with a new metric called “inclusive financing" for small business. This new category is growing rapidly: Loans outstanding were up 23% on the year in the third quarter. But it is also based on a more restrictive definition of “small business”—meaning rapid growth comes from a low base.

“It is hard to avoid the cynical conclusion that since the late-2018 liquidity crisis for private firms, the relevant data series have become too politically sensitive to release systematically,” write Gavekal’s analysts.

Luckily, there are still clues out there on how things really stand. What those suggest is improvement since the dark days of late 2018, but still a markedly worse business environment than 18 months ago.

China’s banking regulator has its own series on small-business lending. This shows loans up 10.1% on the year in the third quarter. That is slightly better than the feeble 8.9% growth logged in late 2018, but a far cry from 23% or 48% growth.

Another hint comes from the bond market. Private companies are still defaulting, but in the last few months they have also started paying back much more of their bond debt, data from Wind shows. One explanation is that small businesses lucky enough to qualify for cheap “inclusive financing” loans from China’s big five banks are using them to pay off expensive bond debt, rather than refinancing through the bond market.

AA-minus bond yields and the overall average yield on bank loans both stand at around 5.5%. But the average rate on new small-business loans from the big five banks was 4.75% year to date. So even if overall lending hasn’t risen that fast, some small businesses have benefited from a big rate cut.

Rebounding profits in the electronics industry and a positive trend in the privately compiled Caixin manufacturing purchasing managers index also indicate that matters, while still difficult, are improving. To be sure, there are signs of renewed weakness in overall credit growth that could derail the recovery. So could new U.S. tariffs on imports from China, still set to be introduced on Dec. 15.

Taking the temperature of China’s economy often involves a scavenger hunt for reliable data, but it can be done.


The Relentless Road To Recession Continued

 
by: David Haggith
 
Summary
 
- While the stock market has continued to rise, earnings have gone down quarter after quarter,
 both actual earnings and projected.

- Earnings would be much further down if not boosted by tax cuts, and earnings per share would be down even more if not boosted by massive share buybacks.

- What's driving stocks up besides buybacks?


Consider this a travelogue in pictures (graphs and charts really) that presents a rather striking and comprehensive image of a nation journeying into recession. Our decline is steeper now than it was even in my retelling of economic turns during the summer and early fall.
 
While the stock market has continued to rise (and I never said it wouldn't rise this year until and unless recession begins and takes it down), earnings - upon which stock valuations used to be based in times long ago - have gone down quarter after quarter - both actual earnings and projected.
 

 
Earnings would be much further down if not boosted by tax cuts, and earnings per share (down on average 2.3% YoY) would be down even more if not boosted by massive share buybacks because business revenue is generally down (lowest since the Obama years).
 
Sales are generally down. Fourth-quarter revenue and earnings are projected to be lower still on a broader basis that includes services.
 
These downshifts in revenue are likely to result in further cost-cutting in order to keep earnings from sinking as much, and those cost-cutting measures could include labor, thus slowing consumer capacity, which has been the only thing left holding the economy's head above water.
 
What's driving stocks up besides buybacks?
 
Could it be the new QE where a quarter of a trillion dollars is working its way back up through markets?
 
If so, the market may be getting a little ahead of itself:

 
It looks like the market has priced in a lot more QE4 than the Fed has promised. In fact, it looks like it has already priced in QE4ever. While I believe QE4ever is the course we are now on, the market might be a bit premature to price it all in at once.
 
While the Fed's QE may push stocks up more, we've seen years of proof that almost none of it trickles down to consumer capacity, so QE will not do much to boost the general economy as it sinks into recession due to consumers pulling back, which you'll see below consumers now appear to be doing.
 
If the market goes up due to the Fed's new QE4ever, it will be all the more out of sync with the underlying economy, which is likely to continue going down, in spite of the Fed's QE, since Main Street and Joe and Joline Average are not QE participants.
 
This, however, is not an article about what will happen to the stock market this year. I merely have to take the incongruity of its rise in a failing economy into consideration.
 
Whether we are now in a melt-up toward a blow-off top in stocks or not remains to be seen, but what doesn't remain to be seen is whether or not the US economy (and global economy) is still moving relentlessly into recession at an even faster clip.
 
Yes, it does remain to be seen whether or not the economy has already entered recession as I said it would by this time this year, but what doesn't remain to be seen is whether or not all economic movements have continued to devolve toward recession.
 
GDP ain't what it used to be
 
Admittedly, I thought GDP growth would be close to flat in the third quarter and would go negative in the fourth, but the third-quarter turned out better than I thought it would at 1.9% and appears to be contrary to my recession prediction:

As you can see below, however, real GDP growth, which factors in inflation, often plunged from higher levels than today's GDP growth number straight into recession in a single quarter:
 
 
 
It would not be at all unusual for it to do so now.
 
In fact, we saw GDP growth drop by much more than that in the quarter going into each of the last two recessions.
 
Notice how, going into the Great Recession, GDP growth dropped in the starting quarter of that recession from a positive 2.5% to negative 2.3%:
 
 
 
It appears GDP may be making such a large quarterly drop again. Already, fourth-quarter GDP growth has been revised down to a projected 0.3% by the Atlanta Fed and 0.39% by the New York Fed, and I should note that the Atlanta Fed's number was 1.0% only two weeks ago. So, the revisions are coming in fast and furious.
 
The green line in the graph below shows how quickly the Atlanta Fed has been revising its estimate of the fourth quarter downward:

 
So, maybe, just maybe, the stock market is a little disjoined from the kinds of business metrics that for decades drove the valuation of stocks and particularly from the general economy.
 
Regardless of what is happening in the Wonderland of stocks, recession in the real economy is rolling downhill quickly. The following is a round-up of economic statistics since the last time I reported on the recession's progress:
 
 
Moreover, the official determination of the start of a recession is not always based just on GDP and can sometimes peg the start of a recession a month or two earlier than the first quarter that goes negative:
A recession is when the economy declines significantly for at least six months.  
There's a drop in the following five economic indicators: real gross domestic product, income, employment, manufacturing, and retail sales. People often say a recession is when the GDP growth rate is negative for two consecutive quarters or more. But a recession can quietly begin before the quarterly gross domestic product reports are out.  
That's why the National Bureau of Economic Research measures the other four factors. That data comes out monthly. When these economic indicators decline, so will GDP. The National Bureau of Economic Research defines a recession as "a period of falling economic activity spread across the economy, lasting more than a few months."  
The NBER is the private non-profit that announces when recessions start and stop. It is the national source for measuring the stages of the business cycle. - The Balance
 
To the extent GDP did grow last quarter, most growth was considered to be largely driven by continued strong consumer spending.
 
In fact, growth in consumer spending was equal to 100% of the overall growth seen in GDP.
 
The only other positive contribution to growth was government spending. In other words, had consumer spending gone down the tiniest fraction, instead of rising, GDP growth would have been negative:

Kansas City Federal Reserve Bank

 
The upper midwest, however, has been hit severely. Wisconsin reports that it is losing two dairy farms every day! That is a lot of loss for one state.
 
As farm bankruptcies soar, it is possible that nearly 10% of Wisconsin dairy farmers may go out of business in 2019. "You look at the weather, you look at the crops you can't get off the field, you look at the bills you can't pay," Edelburg, told Yahoo Finance. "Bankruptcies are up … 24% from last year already." - SHTFplan
 
And "up 24%" is not 24% of a small number. Wisconsin lost almost 1,200 dairy farms between 2016 and 2018! People might be crowing about how nice it is in Florida, but Florida isn't the whole US, and the pain in Wisconsin is severe. Suicide rates, particularly among farmers, have soared:

The USDA farm agency trains its farm loan officers on how to look for warning signs as part of suicide prevention. "The bankers are the first and the forefront to see a lot of these things," Edelburg said. "They're delivering the bad news, and these farmers are dealing with it on that level." - SHTFplan 
Calls to the Wisconsin Farm Center, which helps distressed farmers, were up last year, including a 33 percent increase in November and December compared to the same two months the previous year. - Wisconsin State Journal
Farmers have really been taking it on the lam this year because of the 1-2-3 blow of droughts, floods, and the Trump Trade Wars. Over half of US states are experiencing rising farm bankruptcies, again reaching their highest level since the end of the Great Recession.
 
Transportation rolling downhill
 
It's not surprising, when farms are going out of production and buying less equipment and manufacturing is declining, to find that shipping would also be in decline.
 
The whole picture is in agreement about what is happening.
 
The last time I presented the Cass Freight Index, it looked like this:
 

 
Now, it looks like this:
 

That includes what is now being called a "railroad recession."
 
The American Association of Railroads reported that rail traffic and intermodal container usage has gone … well, off the rails:
 

"There are no pockets of growth," said Bloomberg Intelligence analyst Lee Klaskow…. "There's really nothing that's tapping me on the shoulder saying, 'Hey look at me. I'm going to be your next growth engine.'" - Zero Hedge
 
Need I say more about transportation? I'll only note that as the freight recession (so many things being called a "recession" now) goes on, so go orders of new transportation equipment, creating a feedback loop into automotive production and other manufacturing, which has taken production of all transportation equipment right over a cliff:
Seeking Alpha
Housing keeps collapsing
 
Home pricing has continued to slide with sales, as has competition between buyers.
 
According to Redfin, competition continued to fall away nationally both on a year-on-year basis and a month-on-month basis:
Nationally, just 10 percent of offers written by Redfin agents on behalf of their homebuying customers faced a bidding war in October, down from 39 percent a year earlier and now at a 10-year low. - Redfin

Some regions were up on a month-on-month basis, but all regions were way down year-on-year.
 
Home Depot (NYSE:HD) is a solid bellwether business for gauging the home construction and remodeling business, and it just reported its worst quarter since the Great Recession:

"Home Depot earnings the most disappointing for investors since the financial crisis" 
Shares of Home Depot Inc … sank 4.9% in morning trading Tuesday, which puts them on track to suffer the biggest one-day post-earnings decline in over 10 years. Earlier, the home improvement retailer beat fiscal third-quarter profit expectations but missed on total and same-store sales, and lowered its full-year outlook. The last time the stock fell as much on the day after earnings was May 19, 2009. - MarketWatch
 
Those stated expectations don't sound like Home Depot is expecting home construction to pick up anytime soon, but the decline in construction is not limited to housing; commercial construction has been in recession for some time now:
 
 

Capital investments and business sentiment no longer so capital
 
With manufacturing in recession, freight in recession, new orders of vehicles in recession, farms falling left and right, housing in decline and commercial construction in recession, it is no wonder that investment in fixed assets is falling off a cliff, too:
 
 

 
Thus, we shouldn't be surprised either to see that business sentiment tumbling down a long hill with two out of three measures hitting their lowest low since the Great Recession:
 
 

Thus, it should also not be a surprise that CEOs who are a lot closer to business sentiment than consumers feel much worse about things than consumers who have only just begun to catch on:
 

And, coming close to Donald's own heart, the US hotel industry is also entering recession … at least, as measured by revenue per available room.
 
Certainly travel is one area consumers cut first when they start tightening their belts.
 
Again the trend hasn't sunk this low since the Great Recession:
 
 

Of course, when measured "per available room," the decline could be as much due to overbuilding as due to receding travel.
 
However, that does not appear to be the case - at least in economy rooms - where supply has been shrinking for some time, while demand is also now shrinking:
 

 
Average daily rates (pricing) are even receding in a way not seen since the last two recessions:
 
 

Not-so-gainful employment

With all of that, it's not surprising that employment - the most critical factor in determining recessions - is also starting to turn south.
 
The latest JOLTS report released by the Bureau of Labor Statistics showed the total number of job openings is now trending even more sharply downward:
 
 

 
Of course, the first place companies cut back before firing employees is in overtime hours.
 
As would be expected from the information above about manufacturing orders and production, those hours have already been cut way back in manufacturing to a degree not seen since … the Great Recession:
 

While the unemployment rate has appeared in my past reports to be putting in a bottom, it hasn't turned significantly upward yet.
 
However, with new jobs on such a consistent decline, a significant rise in unemployment cannot be far off. The hiring rate of US companies has fallen to a seven-year low:
Just one-fifth of the economists surveyed by the National Association for Business Economics said their companies have added to their workforces in the past three months. That is down from one-third in July…. A broad measure of job gains in the survey fell to its lowest level since October 2012…. "The U.S. economy appears to be slowing, and respondents expect still slower growth over the next 12 months…." The hiring slowdown comes as more businesses are reporting slower growth of sales and profits…. Government data shows that companies are posting fewer available jobs, suggesting that demand for labor is weakening…. Companies are also cutting back on their investments in machinery, computers, and other equipment. The proportion of firms increasing their spending on such goods is at its lowest level in five years, the survey found. - AP
 
Finally, remember that, when the Bureau of Labor Statistics reconciled its books this year, it found that its monthly new jobs reports had in aggregate overstated the number of new jobs for the past year by half a million.
 
I've pointed out before that this scale of downward revision only happens in the middle of recessions when apparently their methods of surveying new jobs are hugely biased toward the positive:
 
 

Finance

As tightness in all of these areas of the economy continues to press in, it is adversely affecting the world of finance. In 2017, 13 leveraged loans in the S&P/LSTA Index were downgraded.
 
In 2018, the number of downgrades shot up to 244.
 
In 2019, the number rose even more to 282 with two and a half months of a steepening trend still to come in.

The trend of rising downgrades has put in its hockey-stick curve now like this, and you'll see, again, you have to go all the way back to the Great Recession to find a time that looks as bad:

With that, let me leave you with something to think about from a conservative businessman, Oaktree Capital Management's Co-Chairman Howard Marks, talking about our inverted bond world, bubbles, and his belief that we're in a high-risk period:
 

Hong Kong in revolt

China’s unruly periphery resents the Communist Party’s heavy hand

The party cannot win lasting assent to its rule by force alone



A few days ago hundreds of young people, some teenagers, turned the redbrick campus of the Hong Kong Polytechnic University into a fortress. Clad in black, their faces masked in black too, most of them remained defiant as they came under siege. Police shot rubber bullets and jets of blue-dyed water at them. Defenders crouched over glass bottles, filling them with fuel and stuffing them with fuses to make bombs.

Many cheered the news that an arrow shot by one of their archers had hit a policeman in the leg. After more than five months of anti-government unrest in Hong Kong, the stakes are turning deadly.

This time, many exhausted protesters surrendered to the police—the youngest of them were given safe passage. Mercifully, massive bloodshed has so far been avoided. But Hong Kong is in peril. As The Economist went to press, some protesters were refusing to leave the campus, and protests continued in other parts of the city. They attract nothing like the numbers who attended rallies at the outset—perhaps 2m on one occasion in June. But they often involve vandalism and Molotov cocktails.

Despite the violence, public support for the protesters—even the bomb-throwing radicals—remains strong. Citizens may turn out in force for local elections on November 24th, which have taken on new significance as a test of the popular will and a chance to give pro-establishment candidates a drubbing.

The government’s one concession—withdrawing a bill that would have allowed suspects to be sent to mainland China for trial—did little to restore calm. Protesters say they want nothing less than democracy. They cannot pick their chief executive, and elections for Hong Kong’s legislature are wildly tilted. So the protests may continue.

The Communist Party in Beijing does not seem eager to get its troops to crush the unrest. Far from it, insiders say. This is a problem that the party does not want to own; the economic and political costs of mass-firing into crowds in a global financial centre would be huge. But own the problem it does.

The heavy-handedness of China’s leader, Xi Jinping, and public resentment of it, is a primary cause of the turmoil. He says he wants a “great rejuvenation” of his country. But his brutal, uncompromising approach to control is feeding anger not just in Hong Kong but all around China’s periphery.

When Mao Zedong’s guerrillas seized power in China in 1949, they did not take over a clearly defined country, much less an entirely willing one. Hong Kong was ruled by the British, nearby Macau by the Portuguese. Taiwan was under the control of the Nationalist government Mao had just overthrown. The mountain terrain of Tibet was under a Buddhist theocracy that chafed at control from Beijing. Communist troops had yet to enter another immense region in the far west, Xinjiang, where Muslim ethnic groups did not want to be ruled from afar.

Seventy years on, the party’s struggle to establish the China it wants is far from over. Taiwan is still independent in all but name. In January its ruling party, which favours a more formal separation, is expected to do well once again in presidential and parliamentary polls. “Today’s Hong Kong, tomorrow’s Taiwan” is a popular slogan in Hong Kong that resonates with its intended audience, Taiwanese voters.

Since Mr Xi took power in 2012 they have watched him chip away at Hong Kong’s freedoms and send warplanes on intimidating forays around Taiwan. Few of them want their rich, democratic island to be swallowed up by the dictatorship next door, even if many of them have thousands of years of shared culture with mainlanders.

Tibet and Xinjiang are quiet, but only because people there have been terrorised into silence. After widespread outbreaks of unrest a decade ago, repression has grown overwhelming. In the past couple of years Xinjiang’s regional government has built a network of prison camps and incarcerated about 1m people, mostly ethnic Uighurs, often simply for being devout Muslims.

Official Chinese documents recently leaked to the New York Times have confirmed the horrors unleashed there. Officials say this “vocational training”, as they chillingly describe it, is necessary to eradicate Islamist extremism. In the long run it is more likely to fuel rage that will one day explode.

The slogan in Hong Kong has another part: “Today’s Xinjiang, tomorrow’s Hong Kong”. Few expect such a grim outcome for the former British colony. But Hong Kongers are right to view the party with fear. Even if Mr Xi decides not to use troops in Hong Kong, his view of challenges to the party’s authority is clear. He thinks they should be crushed.

This week America’s Congress passed a bill, nearly unanimously, requiring the government to apply sanctions to officials guilty of abusing human rights in Hong Kong. Nonetheless, China is likely to lean harder on Hong Kong’s government, to explore whether it can pass a harsh new anti-sedition law, and to require students to submit to “patriotic education” (ie, party propaganda). The party wants to know the names of those who defy it, the better to make their lives miserable later.

Mr Xi says he wants China to achieve its great rejuvenation by 2049, the 100th anniversary of Mao’s victory. By then, he says, the country will be “strong, democratic, culturally advanced, harmonious and beautiful”. More likely, if the party remains in power that long, Mao’s unfinished business will remain a terrible sore. Millions of people living in the outlying regions that Mao claimed for the party will be seething.

Not all the Communist elite agree with Mr Xi’s clenched-fist approach, which is presumably why someone leaked the Xinjiang papers. Trouble in the periphery of an empire can swiftly spread to the centre. This is doubly likely when the peripheries are also where the empire rubs up against suspicious neighbours.

India is wary of China’s militarisation of Tibet. China’s neighbours anxiously watch the country’s military build-up in the Taiwan Strait. A big fear is that an attack on the island could trigger war between China and America. The party cannot win lasting assent to its rule by force alone.

In Hong Kong “one country, two systems” is officially due to expire in 2047. On current form its system is likely to be much like the rest of China’s long before then. That is why Hong Kong’s protesters are so desperate, and why the harmony Mr Xi talks so blithely of creating in China will elude him.