  We study a constrained optimal control problem with possibly degenerate
coefficients arising in models of optimal portfolio liquidation under market
impact. The coefficients can be random in which case the value function is
described by a degenerate backward stochastic partial differential equation
(BSPDE) with singular terminal condition. For this degenerate BSPDE, we prove
existence and uniqueness of a nonnegative solution. Our existence result
requires a novel gradient estimate for degenerate BSPDEs.
