A Model of Fickle Capital Flows and Retrenchment