We study hedge fund liquidity management in the presence of liquidity risks on the asset and liability sides. We formulate a two-period model where a single fund has always access to a liquid asset and can invest in an illiquid asset which pays off only at the end of period two. Funding liquidity risk takes the form of a random outflow originating from clients in period one. The fund suffers from a random haircut on the illiquid asset's secondary market to cover its outow. We solve the allocation problem of the fund and find its optimal allocation between liquid and illiquid assets. We show that the liquidation probability and the portfolio composition of the fund are revealing about the market liquidity and funding liquidity, respectively. Gates, as a device that limits the outows experienced by the fund, helps it reduce its liquidation risk and harvest liquidity premia.