Opinion Formation and Herding in Financial Markets