Optimal stopping for portfolio management