A hybrid LSTM forecasting, clustering, and reinforcement learning framework for commodity portfolio optimization
Forecasting commodity prices and constructing optimal portfolios remain challenging due to the nonlinear dynamics, high volatility, and regime shifts characterizing global commodity markets. Conventional statistical approaches often fail to adequately capture such complex temporal dependencies. To address these limitations, this paper presents a hybrid framework that integrates Long Short-Term Memory (LSTM) networks for commodity price forecasting and Proximal Policy Optimization (PPO) to enable adaptive, risk-aware portfolio allocation. Unlike conventional two-stage frameworks, where forecasts are passed as fixed inputs to a static optimizer, the proposed approach incorporates LSTM forecasts as state features for the PPO policy, which learns to weight them against realized risk through reward feedback. In addition, clustering techniques including K-Means and Deep K-Means are employed to group commodities exhibiting similar historical dynamics, thereby enhancing pattern extraction across heterogeneous assets. Performance is assessed using risk-adjusted measures, including the Reward-to-Risk (R2R) ratio and the Conditional Value at Risk (CVaR), allowing for a systematic evaluation of return-risk trade-offs. For benchmarking purposes, the Twin Delayed Deep Deterministic Policy Gradient (TD3) algorithm is also considered. Experimental results show that the proposed PPO-LSTM framework outperforms baseline PPO and TD3 models, as well as naive benchmark strategies equal-weighted and market index portfolios, achieving an improvement of 17.04% in final returns and 69.6% in R2R, and a slightly lower mean maximum drawdown in the tested evaluation period. These results indicate that a tightly integrated forecasting-optimization framework can improve risk-adjusted performance and reduce tail-risk exposure in non-stationary commodity markets, based on historical backtesting.
Authors
- Malek Sarhani (ORCID: https://orcid.org/0000-0001-8307-5144)
- Abdelkader O. El Alaoui (ORCID: https://orcid.org/0000-0002-5004-0807)
- Saïd Ouatik El Alaoui (ORCID: https://orcid.org/0000-0003-1194-0578)
- Kenza Elkarnighi (ORCID: https://orcid.org/0009-0002-2374-4734)
Institutions
- Université Ibn-Tofail (MA)
- International University of Rabat (MA)
- Al Akhawayn University (MA)
Publication Details
- Journal
- Social Sciences & Humanities Open
- Published
- 2026-11-02
- DOI
- https://doi.org/10.1016/j.ssaho.2026.103823
- Primary Topic
- Stock Market Forecasting Methods
- Type
- article
- Field-Weighted Citation Impact
- 0.00