RT Journal Article T1 Cybersecure XAI Algorithm for Generating Recommendations Based on Financial Fundamentals Using DeepSeek A1 García-Magariño García, Iván A1 Bravo Agapito, Javier A1 Lacuesta, Raquel AB Background: Investment decisions in stocks are one of the most complex tasks due to the uncertainty of which stocks will increase or decrease in their values. A diversified portfolio statistically reduces the risk; however, stock choice still substantially influences the profitability. Methods: This work proposes a methodology to automate investment decision recommendations with clear explanations. It utilizes generative AI, guided by prompt engineering, to interpret price predictions derived from neural networks. The methodology also includes the Artificial Intelligence Trust, Risk, and Security Management (AI TRiSM) model to provide robust security recommendations for the system. The proposed system provides long-term investment recommendations based on the financial fundamentals of companies, such as the price-to-earnings ratio (PER) and the net margin of profits over the total revenue. The proposed explainable artificial intelligence (XAI) system uses DeepSeek for describing recommendations and suggested companies, as well as several charts based on Shapley additive explanation (SHAP) values and local-interpretable model-agnostic explanations (LIMEs) for showing feature importance. Results: In the experiments, we compared the profitability of the proposed portfolios, ranging from 8 to 28 stock values, with the maximum expected price increases for 4 years in the NASDAQ-100 and S&P-500, where both bull and bear markets were, respectively, considered before and after the custom duties increases in international trade by the USA in April 2025. The proposed system achieved an average profitability of 56.62% while considering 120 different portfolio recommendations. Conclusions: A t-Student test confirmed that the difference in profitability compared to the index was statistically significant. A user study revealed that the participants agreed that the portfolio explanations were useful for trusting the system, with an average score of 6.14 in a 7-point Likert scale. PB MDPI SN 2673-2688 YR 2025 FD 2025-05-02 LK https://hdl.handle.net/20.500.14352/124317 UL https://hdl.handle.net/20.500.14352/124317 LA eng NO García-Magariño, I., Bravo-Agapito, J., & Lacuesta, R. (2025). Cybersecure XAI Algorithm for Generating Recommendations Based on Financial Fundamentals Using DeepSeek. AI, 6(5), 95. https://doi.org/10.3390/ai6050095 NO This research was funded by the project “Proyecto Estratégico de Ciberseguridad Desarrollado en Zonas Escasamente Pobladas”, which was funded by the Instituto Nacional de Ciberseguridad.This work was developed in the context of “Plan de Recuperación, Transformación y Resiliencia”, which is funded by the European Union (Next Generation). This work was also partially supported by the Spanish Ministry of Science [grant number: PID2023-149341OB-I00]. The APC was funded by the first project NO Instituto Nacional de Ciberseguridad (España) NO European Union NO Ministerio de Ciencia, Innovación y Universidades (España) DS Docta Complutense RD 31 dic 2025