OPTIMIZATION OF INVESTMENT PORTFOLIOS USING MONTE CARLO SIMULATION

ОПТИМИЗАЦИЯ ИНВЕСТИЦИОННЫХ ПОРТФЕЛЕЙ С ИСПОЛЬЗОВАНИЕМ МОДЕЛИРОВАНИЯ МОНТЕ-КАРЛО
Popov V. Imankulov T.S.
Цитировать:
Popov V., Imankulov T.S. OPTIMIZATION OF INVESTMENT PORTFOLIOS USING MONTE CARLO SIMULATION // Universum: технические науки : электрон. научн. журн. 2026. 6(147). URL: https://7universum.com/ru/tech/archive/item/22890 (дата обращения: 08.07.2026).
Прочитать статью:
Статья поступила в редакцию: 20.05.2026
Принята к публикации: 27.05.2026
Опубликована: 28.06.2026

 

УДК 336.76+519.876

Abstract

This article presents a computational framework for investment portfolio optimization based on Monte Carlo simulation and constrained numerical optimization. The study uses daily adjusted stock prices for fifteen U.S. equities over the period from January 2023 to January 2026 to estimate expected returns, volatilities, and the covariance matrix. Candidate portfolios are generated through random weight sampling under practical allocation constraints, including full investment, a maximum individual asset weight, and a concentration limit based on the Herfindahl-Hirschman Index. Portfolio quality is evaluated using annualized return, volatility, the Sharpe ratio, and an investor utility function with a risk-aversion coefficient. The empirical baseline is calculated from the same dataset using an equally weighted portfolio, rather than assumed externally. The obtained results show that SLSQP refinement improves the Sharpe ratio from 1.5072 for the equal-weight baseline to 1.9192 while keeping the HHI at the admissible boundary. The proposed framework demonstrates how Monte Carlo simulation can support diversified portfolio selection and investor-specific risk-return analysis.

Аннотация

В статье представлена вычислительная модель оптимизации инвестиционного портфеля на основе моделирования Монте-Карло и ограниченной численной оптимизации. В исследовании используются дневные скорректированные цены пятнадцати акций за период с января 2023 года по январь 2026 года для расчета ожидаемой доходности, волатильности и ковариационной матрицы. Набор допустимых портфелей формируется путем случайной генерации весов с учетом практических ограничений: полного инвестирования капитала, предельного веса одного актива и ограничения концентрации на основе индекса Херфиндаля-Хиршмана. Качество портфеля оценивается по годовой доходности, волатильности, коэффициенту Шарпа и функции полезности с коэффициентом неприятия риска. Эмпирическая базовая модель рассчитывается на той же выборке как равновзвешенный портфель, а не задается предположением. Полученные результаты показывают, что уточнение решения методом SLSQP повышает коэффициент Шарпа с 1,5072 для базового портфеля до 1,9192 при сохранении ограничения HHI. Предложенный подход демонстрирует применимость моделирования Монте-Карло для диверсифицированного выбора портфеля и анализа индивидуальных риск-профилей инвестора.

 

Keywords: portfolio optimization, Monte Carlo simulation, numerical optimization, Sharpe ratio, diversification, Herfindahl-Hirschman Index, investor utility.

Ключевые слова: оптимизация портфеля, моделирование Монте-Карло, численная оптимизация, коэффициент Шарпа, диверсификация, индекс Херфиндаля-Хиршмана, функция полезности инвестора.

 

Introduction

Portfolio optimization is a central problem in financial engineering because asset returns are uncertain and portfolio risk depends not only on the volatility of individual securities but also on correlations between them. Modern portfolio optimization research includes the classical mean-variance framework, performance measurement, the Black-Litterman approach, robust optimization, Bayesian portfolio analysis, and recent survey evidence on portfolio optimization [1]-[8]. However, practical portfolio construction also requires additional constraints related to diversification, concentration, and investor preferences.

Monte Carlo simulation provides a flexible way to explore a broad feasible portfolio space. Instead of relying only on a single deterministic solution, the method generates many candidate allocations and evaluates each of them using selected risk-return criteria. Previous studies show that Monte Carlo techniques can be applied to financial engineering, simulation theory, derivative pricing, multilevel Monte Carlo, CVaR optimization, and recent portfolio rebalancing applications [9]-[14]. This makes the method suitable for portfolio analysis with practical restrictions such as maximum asset weights and diversification limits.

Related studies also show that portfolio optimization and financial simulation have been extended through naive diversification benchmarks, covariance-matrix shrinkage, robust portfolio selection, active robust management, and recent risk-optimization approaches [15]-[19]. These works provide methodological context, while the present article focuses on a reproducible Monte Carlo implementation for portfolio allocation.

The purpose of this study is to develop and evaluate a Monte Carlo-based framework for investment portfolio optimization. The framework combines stochastic portfolio generation, constrained SLSQP optimization, diversification control through the Herfindahl-Hirschman Index (HHI), and investor preference modeling through a utility function. The corrected experimental design avoids assumed benchmark values and reports only empirically calculated portfolio metrics.

Materials and methods

Data collection and preparation

Historical daily adjusted closing prices were collected for fifteen assets: AAPL, MSFT, GOOGL, AMZN, TSLA, JPM, V, WMT, PG, DIS, NFLX, KO, PEP, CSCO, and INTC. The data were stored in a local database named stock_data.db. The final aligned dataset contained 751 trading observations from 4 January 2023 to 31 December 2025, which corresponds to the available trading days in the selected three-year interval. The data processing stage was implemented using Python tools for tabular data handling and numerical computing.

R_i,t = (P_i,t − P_i,t−1) / P_i,t−1,

where P_i,t is the adjusted price of asset i at time t. The expected daily return and covariance matrix were estimated as:

μ_i = (1 / T) Σ R_i,t,

Σ_ij = (1 / (T − 1)) Σ (R_i,t − μ_i)(R_j,t − μ_j).

The daily estimates were annualized using 252 trading days per year. This produced the annualized expected return vector and covariance matrix used throughout the experiment.

Monte Carlo portfolio generation

Monte Carlo simulation was used to generate a set of candidate portfolios. In the conducted experiment, 10,000 portfolios were requested and 1,318 feasible portfolios satisfied the applied constraints. Portfolio weights were sampled so that the full-investment condition was satisfied:

Σ w_i = 1.

The following constraints were applied: the maximum weight of a single asset was limited to 20%; the total portfolio value was set to 1000 dollars; and the diversification constraint was expressed as HHI <= 0.1. For each feasible portfolio, annualized expected return and volatility were calculated as:

R_p = Σ w_i μ_i

σ_p = √(wᵀΣw).

Diversification constraints

The Herfindahl-Hirschman Index was used to measure concentration risk:

HHI = Σ w_i².

A lower value of HHI indicates stronger diversification. For a portfolio of fifteen equally weighted assets, HHI equals approximately 0.0667. In this study, HHI <= 0.1 was selected as a practical diversification threshold. The non-strict inequality is used because numerical optimization may return a solution located directly on the feasible boundary within floating-point tolerance. Therefore, the obtained value HHI = 0.1000 is treated as a feasible boundary solution rather than a violation of the diversification constraint.

Optimization criteria

The main optimization criterion was the Sharpe ratio:

SR = (R_p - r_f) / sigma_p,

where r_f is the annual risk-free rate. In this experiment, r_f was set to 0.02. The constrained optimization problem can be written as:

maximize SR(w), subject to sum(w_i)=1, 0 <= w_i <= 0.2, HHI <= 0.1.

The best Monte Carlo candidates were refined using the Sequential Least Squares Programming (SLSQP) algorithm. SLSQP was selected because it supports nonlinear constraints and bound constraints, which are required for the HHI and maximum-weight restrictions.

To model investor preferences, the utility function was defined as:

U = R_p - (lambda / 2) * sigma_p^2,

where lambda is the risk-aversion coefficient. Higher values of lambda penalize volatility more strongly and shift the optimal allocation toward lower-risk portfolios.

Computational Implementation and reproducibility

The implementation was organized as a single-process Python workflow. Historical prices were loaded from the local database, returns and covariance matrices were calculated with Python numerical tools, constrained optimization was performed with SciPy, and visualizations were prepared as separate result files. The experiment is reported as a reproducible numerical case study rather than a hardware performance benchmark.

Table 1. Computational setup of the experiment

Parameter

Value

Assets

15

Historical observations

751 trading days

Data period

January 2023 - January 2026

Requested Monte Carlo portfolios

10,000

Feasible portfolios after constraints

1,318

Optimization method

SLSQP

Maximum single-asset weight

20%

Diversification constraint

HHI <= 0.1

Initial portfolio value

$1000

Recorded runtime

0.357 seconds

 

Results and discussion

Efficient frontier and key portfolio metrics

The Monte Carlo simulation produced a set of feasible portfolios distributed across the risk-return plane. Figure 1 shows the efficient frontier approximation and highlights the best Monte Carlo candidates according to the maximum Sharpe ratio, minimum volatility, and maximum diversification criteria.

 

Figure 1. Efficient frontier of Monte Carlo portfolio candidates.

 

Table 2. Performance comparison of key portfolios

Portfolio type

Return

Volatility

Sharpe ratio

HHI

SLSQP Max Sharpe

0.3132

0.1528

1.9192

0.1000

SLSQP Min Volatility

0.1606

0.1127

1.2473

0.1000

Equal-weight empirical baseline

0.2569

0.1571

1.5072

0.0667

Best Monte Carlo candidate

0.3032

0.1611

1.7578

0.0944

Min Volatility Monte Carlo candidate

0.1702

0.1235

1.2161

0.0950

Max Diversification Monte Carlo candidate

0.2682

0.1650

1.5042

0.0712

 

The SLSQP Max Sharpe portfolio achieved the highest Sharpe ratio of 1.9192. The empirical equal-weight baseline achieved a Sharpe ratio of 1.5072 on the same dataset. Therefore, the improvement over the empirical baseline is approximately 27.3%. The comparison is based on calculated results from the same data and constraints, rather than on an assumed benchmark value.

The HHI values in Table 2 are internally consistent with the stated constraint. The SLSQP solutions are located on the boundary HHI = 0.1 within numerical tolerance, while the Monte Carlo candidates remain below the threshold. This resolves the inconsistency that may arise when strict notation HHI < 0.1 is used despite boundary solutions returned by constrained optimization.

Optimized portfolio allocation

Table 3 presents the allocation of the SLSQP Max Sharpe portfolio. The dollar allocation is calculated as weight multiplied by the total portfolio value of 1000 dollars. The sum of HHI contributions equals 0.1000 after rounding, which corresponds to the total HHI of the optimized portfolio.

Table 3. Optimized allocation for the SLSQP Max Sharpe portfolio

Asset

Weight

Dollar allocation

HHI contribution

AAPL

0.0580

$58.04

0.0034

MSFT

0.0640

$63.98

0.0041

GOOGL

0.1355

$135.50

0.0184

AMZN

0.0553

$55.28

0.0031

TSLA

0.0444

$44.39

0.0020

JPM

0.1246

$124.58

0.0155

V

0.0684

$68.39

0.0047

WMT

0.1578

$157.80

0.0249

PG

0.0347

$34.71

0.0012

DIS

0.0000

$0.00

0.0000

NFLX

0.1164

$116.39

0.0135

KO

0.0784

$78.43

0.0062

PEP

0.0068

$6.79

0.0000

CSCO

0.0557

$55.71

0.0031

INTC

0.0000

$0.00

0.0000

Total

1.0000

$1000.00

0.1000

 

Figure 2. Optimized portfolio allocation

 

The largest weights are assigned to WMT, GOOGL, JPM, and NFLX, while DIS and INTC receive zero weights in the optimized solution. No asset exceeds the 20% maximum weight constraint, and the portfolio remains within the selected concentration boundary.

Effect of risk aversion

The utility function demonstrates how portfolio characteristics change when the investor becomes more risk-averse. Table 4 summarizes the optimized portfolios for different values of lambda.

Table 4. Utility-based optimization by risk-aversion coefficient

lambda

Return

Volatility

Sharpe ratio

HHI

1.0

0.3854

0.2177

1.6784

0.1000

2.0

0.3838

0.2126

1.7112

0.1000

3.0

0.3805

0.2064

1.7464

0.1000

4.0

0.3757

0.1997

1.7816

0.1000

5.0

0.3696

0.1927

1.8141

0.1000

10.0

0.3313

0.1630

1.9099

0.1000

 

Figure 3. Risk-return tradeoff by risk-aversion coefficient

 

Figure 4. Sharpe ratio by risk-aversion coefficient

 

As lambda increases from 1 to 10, expected return decreases from 0.3854 to 0.3313 and volatility decreases from 0.2177 to 0.1630. This confirms that the utility function shifts the optimal solution toward lower-risk allocations. In this dataset, the Sharpe ratio increases with stronger risk aversion because the reduction in volatility is proportionally larger than the reduction in expected return.

Terminal value simulation and risk interpretation

To evaluate the distribution of possible portfolio outcomes, terminal values were simulated for an initial portfolio value of 1000 dollars. The distribution is shown in Figure 5.

 

Figure 5. Simulated terminal portfolio values

 

Table 5. Simulated terminal-value risk metrics

Metric

Value

Mean terminal value

$1373.23

Median terminal value

$1356.65

Probability of loss

2.10%

Return VaR

0.0549

Return CVaR

-0.0023

Mean maximum drawdown

-0.0915

Worst maximum drawdown

-0.2760

 

The mean simulated terminal value equals 1373.23 dollars, while the median equals 1356.65 dollars. The estimated probability of loss is 2.10%. These results indicate that the optimized portfolio has a favorable expected outcome over the simulation horizon, although downside risk remains present and should be considered in practical applications.

Practical implications

The proposed framework can be used in educational analytical systems, financial planning tools, and prototype robo-advisory applications. Its main advantage is the combination of stochastic portfolio exploration, diversification control, empirical baseline comparison, and investor-specific utility analysis. For the studied 15-asset case, the method is sufficiently transparent and reproducible while still producing interpretable portfolio metrics and visualizations.

Conclusion

This study developed and evaluated a Monte Carlo-based framework for investment portfolio optimization. The corrected methodology uses historical data from January 2023 to January 2026, generates 10,000 candidate portfolios, applies a diversification constraint based on HHI <= 0.1, and refines the best candidate using SLSQP optimization.

The empirical results show that the SLSQP Max Sharpe portfolio achieves an annualized return of 0.3132, volatility of 0.1528, Sharpe ratio of 1.9192, and HHI of 0.1000. Compared with the equally weighted empirical baseline, the optimized portfolio improves the Sharpe ratio by approximately 27.3%. The allocation table confirms that the sum of all weights equals 1.0000, the total dollar allocation equals 1000 dollars, and the sum of HHI contributions equals the reported HHI value.

The revised computational discussion avoids unsupported performance claims and reports the experiment as a reproducible numerical implementation. Future research may extend the framework by adding transaction costs, periodic rebalancing, stress testing, alternative risk measures such as CVaR, and comparison with additional optimization models.

 

References:

  1. Markowitz, H. M. (1952). Portfolio Selection. The Journal of Finance, 7(1), 77–91. https://doi.org/10.1111/j.1540-6261.1952.tb01525.x
  2. Sharpe, W. F. (1966). Mutual Fund Performance. The Journal of Business, 39(1), 119–138. https://doi.org/10.1086/294846
  3. Black, F., & Litterman, R. (1992). Global Portfolio Optimization. Financial Analysts Journal, 48(5), 28–43. https://doi.org/10.2469/faj.v48.n5.28
  4. Bertsimas, D., & Sim, M. (2004). The Price of Robustness. Operations Research, 52(1), 35–53. https://doi.org/10.1287/opre.1030.0065
  5. Fabozzi, F. J., Huang, D., & Zhou, G. (2010). Robust Portfolios: Contributions from Operations Research and Finance. Annals of Operations Research, 176(1), 191–220. https://doi.org/10.1007/s10479-009-0515-3
  6. Avramov, D., & Zhou, G. (2010). Bayesian Portfolio Analysis. Annual Review of Financial Economics, 2(1), 25–47. https://doi.org/10.1146/annurev-financial-120209-133947
  7. Meucci, A. (2005). Risk and Asset Allocation. Springer. https://doi.org/10.1007/b138378
  8. Salo, A., Doumpos, M., Liesiö, J., & Zopounidis, C. (2024). Fifty years of portfolio optimization. European Journal of Operational Research, 318(1), 1–18. https://doi.org/10.1016/j.ejor.2023.12.031
  9. Glasserman, P. (2004). Monte Carlo Methods in Financial Engineering. Springer.
  10. Rubinstein, R. Y., & Kroese, D. P. (2017). Simulation and the Monte Carlo Method (3rd ed.). Wiley.
  11. Broadie, M., & Glasserman, P. (1996). Estimating Security Price Derivatives Using Simulation. Management Science, 42(2), 269–285. https://doi.org/10.1287/mnsc.42.2.269
  12. Giles, M. B. (2008). Multilevel Monte Carlo Path Simulation. Operations Research, 56(3), 607–617. https://doi.org/10.1287/opre.1070.0496
  13. Rockafellar, R. T., & Uryasev, S. (2000). Optimization of Conditional Value-at-Risk. The Journal of Risk, 2(3), 21–41. https://doi.org/10.21314/JOR.2000.038
  14. Meher, P., & Mishra, R. K. (2024). Risk-Adjusted Portfolio Optimization: Monte Carlo Simulation and Rebalancing. Australasian Accounting, Business and Finance Journal, 18(3), 85–101. https://doi.org/10.14453/aabfj.v18i3.06
  15. DeMiguel, V., Garlappi, L., & Uppal, R. (2009). Optimal versus Naive Diversification: How Inefficient Is the 1/N Portfolio Strategy? The Review of Financial Studies, 22(5), 1915–1953. https://doi.org/10.1093/rfs/hhm075
  16. Ledoit, O., & Wolf, M. (2004). A Well-Conditioned Estimator for Large-Dimensional Covariance Matrices. Journal of Multivariate Analysis, 88(2), 365–411. https://doi.org/10.1016/S0047-259X(03)00096-4
  17. Georgantas, A., Doumpos, M., & Zopounidis, C. (2024). Robust optimization approaches for portfolio selection: A comparative analysis. Annals of Operations Research, 339(3), 1205–1221. https://doi.org/10.1007/s10479-022-05047-1
  18. Kovalenko, I., Conlon, T., & Cotter, J. (2025). Active portfolio management using robust optimization. Annals of Operations Research. https://doi.org/10.1007/s10479-025-06558-9
  19. Mandal, P. K., Thakur, M., & Mittal, G. (2024). Credibilistic portfolio optimization using improved genetic algorithm and data envelopment analysis with continuous beta distribution. Applied Soft Computing, 151, 111155. https://doi.org/10.1016/j.asoc.2023.111155
Информация об авторах

Student, School of Information Technology and Engineering,
Kazakh-British Technical University,
Kazakhstan, Almaty
E-mail: mr.spv2002@mail.ru

студент, Школа информационных технологий и инженерии,
Казахстанско-Британский технический университет,
Казахстан, г. Алматы

Associate Professor, PhD,
Al-Farabi Kazakh National University,
Kazakhstan, Almaty

PhD, доц.,
Казахский национальный университет имени аль-Фараби,
Казахстан, г. Алматы

ISSN 2311-5122. Метаданные статей журнала размещаются на платформе eLIBRARY.RU.
Св-во о регистрации СМИ: ЭЛ №ФС77-54434 от 17.06.2013
Учредитель журнала: ООО «МЦНО»
Главный редактор - Звездина Марина Юрьевна.
Top