Financial stability: theory and applications