The Architecture of Markets