How does automation reshape markets? Existing sociological studies have argued that market automation need not entail a dilution of social relations, but the empirical evidence is inconclusive. Our multi-period ethnography of the New York Stock Exchange addresses this gap by exploring how the NYSE automated trading while preserving its floor intermediaries. Our study reports on observations in 2003 before automation was introduced, outlining the functions traditionally played by specialists and floor brokers. It then analyzes how the Exchange preserved these intermediary roles in 2006-08 as it introduced algorithmic order matching, and proposes the notion of folding to denote the process of automating a market while preserving its social structure. Finally, our analysis of the Flash Crash in 2010 suggests that folding allowed the NYSE to outperform its floorless rivals.