This paper presents a "first generation" model of speculative attacks on emerging markets. Credit-constrained governments accumulate liquid assets in order to self-insure against shocks to national consumption. Governments also insure poorly regulated domestic financial markets. Given this policy regime, a variety of internal and external shocks generate capital inflows followed by anticipated speculative attacks. The model suggests that a common shock generated capital inflows to emerging markets in Asia and Latin America after 1989. Country-specific factors determined the timing of speculative attacks. Economic reform programs may also have generated capital inflow/crisis sequences.