We investigate the optimization of a securitized asset pool for collateralized loan obligation (CLO) transactions. Defining economic risk transfer as the objective function for optimization and the crucial underlying motivation for banks to engage in balance-sheet CLOs, we present the mathematical description of this optimization problem. The criteria applied by rating agencies to CLO transactions add both linear and non-linear constraints to this optimization task. As such problems may not be solved in closed form, we develop a heuristic algorithm and test it with realistic credit portfolio data. The application of this algorithm could support banks as originators when selecting an optimal securitized portfolio from an eligible asset pool. The algorithm becomes particularly relevant when considering the current credit crisis and the subsequent need for liquidity in banking: retained CLO tranches could be used as collateral in repo transactions with central banks and establish an alternative source of funding.