An agent-based model for financial vulnerability