Dealers compete to attract order flow by posting the terms at which they execute trades, which can include prices, quantities, and execution times, and investors direct their orders toward dealers that offer the most attractive terms of trade. Equilibrium outcomes have the following properties. First, investors face a trade-off between trading costs and speeds of execution. Second, the asset market is endogenously segmented in the sense that investors with different asset valuations and different asset holdings will trade at different speeds and different costs. For example, under a Leontief technology to match investors and dealers, per unit trading costs decrease with the size of the trade, in accordance with the evidence from the market for corporate bonds. Third, dealers' implicit bargaining powers are endogenous and typically vary across sub-markets. Finally, the authors obtain a rich set of comparative statics both analytically, by studying a limiting economy where trading frictions are small, and numerically. For instance, the authors find that the relationship between trading costs and dealers' bargaining power can be hump-shaped.