We develop a structural model for the price formation and liquidity supply of an asset. Ourmodel facilitates decompositions of both the bid–ask spread and the return variance intocomponents related to adverse selection, inventory, and order processing costs. Furthermore,the model shows how the fragmentation of trading volume across trading venues influencesinventory pressure and price discovery. We use the model to analyze intraday price formationfor gold futures traded at the Shanghai Futures Exchange. We find that order processing costsexplain about 50% of the futures bid–ask spread, whereas the remaining 50% is equally due toasymmetric information and to inventory costs. About a third of the variance in futures returnsis attributable to microstructure noise. Trading at the spot market has a significant influence onfutures price discovery, but only a limited impact on the futures bid–ask spread.