This paper presents a model that reproduces the uncovered interest rate parity puzzle. Investors have preferences with external habits. Countercyclical risk premia and procyclical real interest rates arise endogenously. During bad times at home, when domestic consumption is close to the habit level, the representative investor is very risk averse. When the domestic investor is more risk averse than her foreign counterpart, the exchange rate is closely tied to domestic consumption growth shocks. The domestic investor therefore expects a positive currency excess return. Because interest rates are low in bad times, expected currency excess returns increase with interest rate differentials.