We propose a systematic algorithmic reverse-stress testing methodology to create ``worst case" scenarios for regulatory stress tests by accounting for losses that arise from distressed portfolio liquidations. First, we derive the optimal bank response for any given shock. Then, we introduce an...