Portfolio choice and equilibrium in capital markets with safety-first investors