We analytically derive optimal central bank portfolios in a minimum variance framework with two assets and "transaction demands" caused by sudden stops in capital inflows. In this model, the transaction demands become less important relative to traditional portfolio objectives as debt to reserve ratios decrease. We empirically estimate optimal dollar and euro shares for 24 emerging market countries and find that optimal reserve portfolios are dominated by anchor currencies and, at current debt to reserve ratios, introducing transactions demand has a relatively modest effect. We also find that euro and dollar bonds act as "safe haven currencies" during sudden stops. Dollars are better hedges for global sudden stops and for regional sudden stops in Asia and Latin America, while the euro is a better hedge for sudden stops in Emerging Europe. We reproduce qualitatively the recent decline in the share of the dollar in emerging market reserves and find that the denomination of foreign currency debt has very little importance for optimal reserve portfolios.