We develop a general framework for applying the Kelly criterion to stock markets. By supplying an arbitrary probability distribution modeling the future price movement of a set of stocks, the Kelly fraction for investing each stock can be calculated by inverting a matrix involving only first and second moments. The framework works for one or a portfolio of stocks and the Kelly fractions can be efficiently calculated. For a simple model of geometric Brownian motion of a single stock we show that ...