A Theory of Competitive Equilibrium in Stock Market Economies