The graph below from VoxEU shows the correlation between home price appreciation and current account deficits/surpluses during the bubble. You can think of current account deficits/surpluses as essentially trade deficits/surpluses. Here's the definition from Wikipedia:
The current account is the sum of the balance of trade (exports minus imports of goods and services), net factor income (such as interest and dividends) and net transfer payments (such as foreign aid).This graph shows that countries with current account deficits tended to have rapid home price appreciation. Countries with current account surpluses tended to have slower home price appreciation.
Why does this matter? Well, the opposite of the current account is the capital account, which is essentially incoming foreign investment. The current account minus the capital account should add up to zero. This graph supports Ben Bernanke's hypothesis that the housing bubble was caused in large part by a global savings glut. Massive savings in China and oil producing countries flowed to the West in the form of financial investment. This financial investment encouraged mortgage lending, which then pushed up real estate prices.
The VoxEU article sums up its analysis as follows:
These results suggest that persistent capital inflows, coupled with securitisation, played a significant role in the housing booms observed in some countries in the run-up to the financial crisis.