Financial market equilibria with heterogeneous agents: CAPM and market segmentation