It happened after World War 1 was incited in June 1914 by the assassination of Archduke Ferdinand. This event triggered a cascade of alliances to be called into effect which brought most European coutnries to war. One month after the assassination, amidst escalating conflict, the New York Stock Exchange shut it’s doors out of fear foreign investors would sell their assets to fund the war effort overseas.
At the time, foreigners owned billions of dollars in U.S. railroad stock. If they sold their assets and accquired gold they could ship the metal overseas and use the currency to fund the war. The United States, who didn’t want to abandon the gold standard, decided to suspend all trading in order to keep whatever gold they had within it’s borders.
The war caused the European countries to abandon or suspend the gold standard. This led to a weakening of their currencies but the exchange rate stayed relatively stable, meaning American goods costed less than their European counterparts. As a result the value of American exports tripled, it’s trade surplus exceeded one billion dollars for the first time, and America changed from a net debtor to a net creditor country.
The shutdown of the NYSE lasted until November 28, 1914.