Messy politics, economic slowdown and a balance of payments deficit: four days of violent anti-government protests across Turkey are reminding investors of another emerging market—South Africa.

Hundreds of Turkish police and protesters have been injured since Friday, when a demonstration to halt construction in a park in an Istanbul square grew into mass protests against what opponents call the authoritarianism of Prime Minister Tayyip Erdogan.

The comparison with South Africa—and with the Arab Spring protests that unseated authoritarian leaders in North Africa in 2011—may work only so far.

The demonstrations across Turkey mostly represent the secular middle classes rejecting what they see as the imposition of Islamist values. The ruling AK Party, having delivered a tripling of per capita incomes since it came to power in 2002 and restored Turkey‘s investment grade rating, still enjoys broad support.

South Africa’s troubles run far deeper, including falling metals prices, a largely unskilled population and youth unemployment around 50 percent. As labor unrest explodes, the ruling party, the 101-year old ANC, is increasingly unpopular.

These problems put South Africa at the forefront of the selloff that slammed emerging markets last month.

But what Turkey and South Africa have in common are current account deficits of more than 6 percent of their gross domestic product (GDP), the biggest among major emerging economies.

Turkey needs to find almost $50 billion this year to finance this deficit—and like South Africa, it is almost totally reliant on stock-and-bond flows to plug the gap.

Add to that political unrest and it is easy to see why Turkish stock markets reacted to a fourth straight day of the protests by tanking almost 7 percent, heading for their biggest one-day fall since October 2008. Bond yields surged 25 bps on Monday.

“What we are seeing does not amount to a Turkish Spring,” said Zsolt Papp at Swiss investor UBP.

“But if a market has had a very good run and investors feel its economy is running out of steam, political instability provides the perfect excuse to sell,” said Papp, who helps manage 1.2 billion euros ($1.6 billion) in emerging debt. He is neutral on Turkish bonds.

Turkey certainly has had a good run this year. A newly minted investment grade credit rating has helped bring record inflows to its stock and bond markets. Its local borrowing costs fell a whole percentage point to all-time lows between January and May while stocks surged to successive record highs.

It has built up hard currency reserves and its exports, thanks to the Middle East, are healthy. Fitch said political risk was already factored into its investment-grade rating.

Yet Turkey‘s markets also sank last month: the lira fell almost 5 percent versus the dollar and yields on local bonds jumped around 80 basis points, even before the latest losses.

Now Tim Ash, emerging markets analyst at Standard Bank, also reckons it’s time to cut exposure to the credit, given the political and economic strains and the huge rallies that the market enjoyed prior to the latest sell-offs.

He notes that Turkey shares South Africa’s reliance on short-term debt, with debt of around $155 billion falling due in the coming year, way above the amount its central bank holds. A further lira depreciation could make this debt hard to service.

“We would recommend that investors reduce exposure,” he said. “Simply put, on a risk-rewards basis, Turkey does not appear to offer convincing value at present.”

Record Flows

Thanasis Petronikolos, head of emerging market debt at Barings Asset Management, is already underweight Turkish debt.

“The political risks have been part of that but the main reason for us being underweight has been the monetary policy mix and other [macro-economic] challenges,” Petronikolos said.

“Our key concerns are that the current account deficit has started to rise again and … that Turkey continues to be financed by portfolio flows which could be negatively affected if risk aversion increases again.”

Again, South Africa can exemplifies how things can go wrong.

Last year it became only the fourth emerging market to join Citi’s prestigious World Government Bond Index, drawing record inflows of over 90 billion rand to its bond markets. Foreigners have cooled to the market since then.

Portfolio inflows covered less than a third of the South African deficit last year, UBS research shows. The gap has been filled by “other investments” – South African banks’ external borrowing.

These loans could turn problematic if the economy fails to recover, given the rand’s 15 percent losses against the dollar this year after last year’s fall of over 4.5 percent.