I develop a theory of financial intermediation to explore how the availability of trading opportunities affects the link between the liquidity of financial institutions and their default decisions. In it, banks hedge against liquidity shocks either in the interbank market or by using a costly bankruptcy procedure, and depositors trade in the asset market without being observed. In this environment, the competitive pressure from the asset markets makes intermediaries choose an illiquid asset portfolio. I prove three results. First, illiquid banks default in equilibrium only when there is systemic risk and an unpredicted crisis hits the economy. Second, in contrast to the previous literature, the allocation at default is not socially optimal. Third, the constrained efficient allocation can be decentralized with the introduction of countercyclical liquidity requirements.