We study a model of a market with three types of agents: sellers, buyers, and middlemen. Buyers and sellers can trade directly or indirectly through the middlemen. The analysis focuses on steady state situations in which the numbers of agents of the different types and hence the trading opportunities are constant over time. The paper provides a framework for analyzing the activity of middlemen and the endogenous determination of the extent of that activity. It highlights the relations between the trading procedure and the distribution of the gains from trade.