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.

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.