Prediction Markets: Theory and Applications