Submitted:
19 March 2024
Posted:
20 March 2024
You are already at the latest version
Abstract
Keywords:
1. Introduction
- Data Enrichment: GPT-based models can analyze and extract valuable insights from a vast corpus of specialized news articles and reports on the energy market. This data enrichment provides a broader context for energy price forecasting models.
- Event Detection: GPT models can detect and highlight significant events [19], such as geopolitical developments, supply disruptions, or regulatory changes, that may impact energy markets. These detected events can be used as input variables for forecasting models.
- Market News Summarization: GPT can generate concise summaries of complex news articles and reports [20] making it easier for analysts and traders to stay informed about market developments. These summaries can serve as valuable inputs for forecasting models.
- Identifying Influential Factors: GPT can identify, and rank factors mentioned in the news and reports likely to influence energy prices. This information can guide feature selection and help prioritize variables in forecasting models.
- Customized reports: In the case of OpenAI's GPT, users can provide customized prompts to extract specific information or insights from news and reports. This allows for tailored analysis based on the unique requirements of the forecasting model.
2. Materials and Methods
2.1. Paradigm 1: In-Context Learning
2.2. Paradigm 2: Fine-Tuning
2.3. Implementation Details
- Impact on Electricity Price (Scale 0-10): The first variable quantifies the perceived impact of each news article on the price of electricity within a scale ranging from 0 (no impact) to 10 (high impact). This quantification allows us to discern the potential influence of each piece of news on energy prices, a critical factor in our forecasting model.
- Direction of Impact (Up, Down, None): We evaluated whether the news articles indicated a potential price impact in the form of an increase ("Up"), a decrease ("Down"), or no discernible impact ("None"). Understanding the Direction of influence is paramount for making informed predictions in the dynamic energy market.
- Impact Period (Past, Short-term, Mid-term, Long-term, None): The third variable delves into the temporal aspect of impact, categorizing it into various periods—Past, Short-term, Mid-term, Long-term, or None. This temporal classification aids in determining when the anticipated price effects are likely to materialize, further enhancing the precision of our forecasts.
2.3.1. In-context Implementation
2.3.2. Fine-Tuned Implementation
- Dataset preparation: Every instance within the dataset should represent a conversation structured in a manner consistent with OpenAI’s Chat Completions API. This structure entails organizing the conversation as a list of messages, where each message comprises a role, content, and the possibility of including a name.
- Validate data formatting and divide training and testing datasets
- Upload dataset file and create the fine-tuning job using the OpenAI SDK.
- Use the new fine-tuned model with the rest of the news and articles to enrich the dataset with calculated variables.
3. Results
- Close Price: If the Direction indicates that the Price will go UP (Figure 6), the OPEN PRICE at the beginning of the first interval when the news is published (interval t) should be LOWER than at least 1 of the CLOSE PRICE values of the current or the following two intervals (t, t+1, t+2). The intervals will be weeks for short-term and months for mid/long-term.
- High/Low: If the Direction indicates that the Price will go UP (Figure 8), the OPEN PRICE at the beginning of the first interval when the news is published (interval t) should be LOWER than at least 1 of the HIGH PRICE values of the current or the following two intervals (t, t+1, t+2). The intervals will be weeks for short-term and months for mid/long-term.Figure 8. OpenAI High/Low Price Metric: Direction UP.

3.1. Short-Term Analysis
3.2. Mid/Long-Term Analysis
4. Discussion
- the incorporation of GPT-calculated features into multivariate time series prediction models as input variables
- influential event detection as early warning signals (natural disasters, geopolitical conflicts, regulatory changes)
- automatic generation of reports that describe the recent evolution of the electricity market price and the prediction of price trends.
5. Conclusions
Author Contributions
Data Availability Statement
Conflicts of Interest
References
- Pezzutto, S.; Grilli, G.; Zambotti, S.; Dunjic, S. Forecasting Electricity Market Price for End Users in EU28 until 2020—Main Factors of Influence. Energies 2018, 11, 1460. [CrossRef]
- OMI, Polo Español S.A. (OMIE). Market results.2018-2023 Retrieved from OMIE: https://www.omie.es/en.
- World Energy Outlook annual report. 2018- 2023. International Energy Agency.
- WeronR. Electricity price forecasting: A review of the state-of-the-art with a look into the future. Int J Forecast 2014, 30 (4), 1030-1081. [CrossRef]
- Nowotarski, J., & Weron, R. Recent advances in electricity price forecasting: A review of probabilistic forecasting. Renewable and Sustainable Energy Reviews 2018 81, 1548-1568. [CrossRef]
- Qin, Q. X. An effective and robust decomposition-ensemble energy price forecasting paradigm with local linear prediction. Energy Economics 2019, 83, 402-414. [CrossRef]
- Bianco, V.; Manca, O.; Nardini, S. Electricity consumption forecasting in Italy using linear regression models. Energy 2009, 34, 1413–1421. [CrossRef]
- Kumar, U.; Jain, V.K. Time series models (Grey-Markov, Grey Model with rolling mechanism and singular spectrum analysis) to forecast energy consumption in India. Energy 2010, 35, 1709–1716. [CrossRef]
- Hyndman, R.J.; Fan, S. Density forecasting for long-term peak electricity demand. IEEE Trans. Power Syst.2010, 25, 1142–1153. [CrossRef]
- Kamalov, F., Sulieman, H., Moussa, S., Avante Reyes, J., & Safaraliev, M. (2024). Powering Electricity Forecasting with Transfer Learning. Energies, 17(3), 626. [CrossRef]
- Kok, M.; Lootsma, F.A. Pairwise-comparison methods in multiple objective programming, with applications in a long-term energy-planning model. Eur. J. Oper. Res. 1985, 22, 44–55. [CrossRef]
- Zhao, L. T., Zeng, G. R., Wang, W. J., & Zhang, Z. G. Forecasting oil price using web-based sentiment analysis. Energies 2019,12(22), 4291. [CrossRef]
- Kheiri, K., & Karimi, H. Sentimentgpt: Exploiting GPT for advanced sentiment analysis and its departure from current machine learning. arXiv preprint 2023 arXiv:2307.10234. [CrossRef]
- Nguyen, T.H.; Shirai, K.; Velcin, J. Sentiment analysis on social media for stock movement prediction. Expert Syst. Appl. 2015, 42, 9603–9611. [CrossRef]
- Santos, M. V., Morgado-Dias, F., & Silva, T. C. Oil Sector and Sentiment Analysis—A Review. Energies 2023, 16(12), 4824. [CrossRef]
- Breitung, C., Kruthof, G., & Müller, S. Contextualized Sentiment Analysis using Large Language Models. Available at SSRN 2023. [CrossRef]
- Lund, B. D. A brief review of ChatGPT: its value and the underlying GPT technology. Preprint. University of North Texas. Project: ChatGPT and Its Impact on Academia. 2023, Doi, 10.. [CrossRef]
- Kamnis, S. Generative pre-trained transformers (GPT) for surface engineering. Surface and Coatings Technology, 2023, 129680. [CrossRef]
- Veyseh, A. P. Unleash GPT-2 power for event detection. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, 2021, Volume 1: Long Papers, 6271-6282.
- Goyal, T. L. News summarization and evaluation in the era of gpt-3. arXiv preprint 2022, arXiv:2209, 12356. [CrossRef]
- Lopez-Lira, A., & Tang, Y. Can chatgpt forecast stock price movements? return predictability and large language models. arXiv preprint 2023 arXiv:2304.07619.
- Liu, J. S. What Makes Good In-Context Examples for GPT-3? arXiv preprint 2021 arXiv:2101.06804. [CrossRef]
- OpenAI. Fine-tuning. 2023, Retrieved from OpenAI platform: https://platform.openai.com/ docs/guides/fine-tuning.
- CincoDías - ElPaís. CincoDías Energía. Retrieved from CincoDías – ElPaís. 2018-2023 https://cincodias.elpais.com/noticias/energia/.
- EnergyNews. EnergyNews Mercado Electrico. Retrieved from EnergyNews. 2018-2023 - Todo Energía: https://www.energynews.es/mercadoelectrico/.
- GrupoASE. Informe Mercado. 2018-2023. Retrieved from Grupo ASE: https://informesdemercado.grupoase.net/ en/inicio-2/.
- Exclusivas Energéticas. Informes Mindee. 2018- 2023. Retrieved from Exclusivas Energéticas: https://exclusivas-energeticas.com/.
- Engle, R. F. Measuring and testing the impact of news on volatility. The journal of finance 1993, 48 (5), 1749-1778. [CrossRef]
- Lewis, P., Perez, E., Piktus, A., Petroni, F., Karpukhin, V., Goyal, N., ... & Kiela, D. Retrieval-augmented generation for knowledge-intensive nlp tasks. Advances in Neural Information Processing Systems, 2020, 33, 9459-9474. [CrossRef]
- Gao, Y., Xiong, Y., Gao, X., Jia, K., Pan, J., Bi, Y., ... & Wang, H. Retrieval-augmented generation for large language models: A survey. arXiv preprint 2023 arXiv:2312.10997. [CrossRef]












| In-context | Fine-tunned | |
|---|---|---|
| Accuracy Close Price | 0.64 | 0.71 |
| Accuracy High/Low | 0.74 | 0.81 |
| Accuracy Threshold 2% | 0.64 | 0.64 |
| In-context | Fine-tunned | |
|---|---|---|
| Accuracy Close Price | 0.68 | 0.81 |
| Accuracy High/Low | 0.89 | 0.93 |
| Accuracy Threshold 5% | 0.80 | 0.86 |
| 1 | https://github.com/AMM-UJI/energy-price-prediction-OpenAI. |
| 2 | The weights in the formula are a simplified approximation to the area under the curve for “exponential decay” and “Gaussian model” as per in Figure 2. |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
