A first-generation crisis model explains an attack on a peg by fundamentals inconsistent with it: domestic credit that grows while the peg holds drains reserves until speculators take the rest. A second-generation crisis model lets the government choose whether to defend, weighing the peg against its costs, so that expectations of devaluation can fulfil themselves. A third-generation crisis runs through balance sheets: banks and firms with debts in foreign currency are ruined by the devaluation, which turns a currency crisis into a banking and output crisis.
attack.py)