In an unexpected surprise, China seems to have withstood massive capital outflows and the Trump trade war to see its foreign exchange reserves rising $5.82 billion to $3.14 trillion in July.

Data from the People's Bank of China (PBOC), the de facto central bank, showed an unexpected rise from June when reserves rose $1.51 billion from May. On the whole, however, the yuan has plummeted 6.3 percent since June 14 due to Trump's trade war.

The yuan weakened for a fourth straight month in July, the longest streak since early 2015, and looks to extend that losing streak into August. On July 20, the yuan skidded to a 12-month low of 6.8 to the dollar, or 7.6 percent lower compared to mid-February.

"Foreign exchange reserves rose $5.8 billion, or 0.19% from a month earlier, to $3.1179 trillion at the end of July, the central bank said," said Chinese state-run media. "China's gold reserves remained unchanged at 59.24 million ounces, with a value of $72.324 billion, down from about $74.07 billion at the end of June."

The uplifting news about the rise in China's forex reserves, however, does nothing to dispel concerns about the relentless capital outflows due to the yuan's unrestricted loss of value.

On the other hand, Dutch multinational financial services firm, ING Group, said the "recent depreciation of the yuan" had failed to spark "massive capital outflows."

"Going forward, we expect reserves to remain relatively stable as the central bank steps in and the government expand FDI [foreign direct investment] inflows. If the yuan depreciation speeds up again, like earlier this month, then the PBOC is likely to reintroduce the 'counter-cyclical factor' to cap the yuan depreciation level [to] discourage massive capital outflows."

Trump and his advisers, however, are gloating over the yuan's continuing loss of value.

Larry Kudlow, Director of the National Economic Council under Trump, last week boasted the continued pressure on the yuan is a sign that "money" is "leaving China," as Trump's trade war worsens.

"Some of the fall is money leaving China," said Kudlow. "If money leaves China, and the currency could be a leading indicator, they're going to be in a heap of trouble."

China hasn't deliberately depreciated the yuan's exchange rate in a decade. PBOC, however, has intervened over the past three years to keep the yuan in line with a strengthening dollar. This costly decision means PBOC is forced to spend up to tens of billions of dollars a month from China's hefty but dwindling foreign currency reserves.

PBOC apparently has more than enough monetary resources to defend the yuan, with $3.2 trillion in foreign currency serves at the end of June.