In the field of asset allocation, how to balance the returns of an investment portfolio and its fluctuations is the core issue. Capital asset pricing model, arbitrage pricing theory, and Fama–French three-factor model were used to quantify the price of individual stocks and portfolios. Based on the second-order stochastic dominance rule, the higher moments of return series, the Shannon entropy, and some other actual investment constraints, we construct a multiconstraint portfolio optimization model, aiming at comprehensively weighting the returns and risk of portfolios rather than blindly maximizing its returns. Furthermore, the whale optimization algorithm based on FTSE100 index data is used to optimize the above multiconstraint portfolio optimization model, which significantly improves the rate of return of the simple diversified buy-and-hold strategy or the FTSE100 index. Furthermore, extensive experiments validate the superiority of the whale optimization algorithm over the other four swarm intelligence optimization algorithms (gray wolf optimizer, fruit fly optimization algorithm, particle swarm optimization, and firefly algorithm) through various indicators of the results, especially under harsh constraints.