Endogenous Market Structures and the Macroeconomy