This paper reproduces the slope of the uncovered interest rate parity (UIP) regression for six different country pairs within one standard deviation under rational expectations. While standard theory predicts a slope of one, the empirically observed slope of the regression of currency returns on the interest rate differential between two countries is negative for most country pairs. This empirical fact that, on average, investors require higher returns on bonds denominated in a currency expected to appreciate, poses a strong challenge for economic models. In this paper, we propose a potential explanation within an infinite horizon dynamic stochastic general equilibrium model with incomplete markets. Heterogenous investors experience varying risk aversion as a result of habit formation. The underlying mechanism of the model relies on varying international diversification in the investors’ portfolio choice decision. In response to their changing habit levels, investors’ hedging desire varies over time, leading to adjustments in interest rates. The habit-induced investment decisions are negatively correlated with exchange rate movements. This leads to a negative correlation between interest rates and expected exchange rates, as implied by a negative UIP slope. Depending on the magnitude of habits, the model is capable of reproducing positive as well as negative UIP slopes, as seen empirically in the data.