1 Introduction

The financial market is in a complex process of metamorphosis after the appearance of cryptocurrencies. These financial assets have aroused the interest of portfolio investors both from the perspective of the speculative opportunities they offer but also due to the possibilities of use for hedging strategies and diversification of portfolios of classic financial instruments Salisu and Obiora, [38]). The scale of cryptocurrency transactions, the decentralized trading mechanism, the dramatic fluctuations recorded over time but also the lack of regulation have determined the increase in attention for this market from portfolio investors, public authorities, researchers and other categories of stakeholders Bouriet al. [10]; Fang et al. [19]; García-Corral et al. [21]; Rao et al. [37].

Investors' interest in this financial asset has gradually made cryptocurrencies, and in particular Bitcoin, acquire the classic functions of money, namely currency of exchange, standard of value, currency of payment and Bitcoin as a medium of exchange, a unit of account and a store of value. Researchers' interest in cryptocurrencies has increased over time, being addressed specific aspects such as the relationship between financial assets—cryptocurrencies, market efficiency of the crypto market, financing risks, market efficiency Tiwari et al. [49]; Șcheau et al. [44]; Wu et al. [59]; Aivaz et al. [5], investors herding behavior, cryptocurrency as safe haven, blockchain technologies, need to regulate transactions, money laundry and financing terrorism Alexandros, [3]; Dzidzikashvili and Kheladze, [16]; Șcheau and Achim, [43]; Wang et al. [57].

The emergence of cryptocurrencies was generated by two major trends recorded in the international economy, namely the digital revolution and the scandals and different crises that shook the international financial system and that weakened the confidence of investors and financial consumers in banking institutions in particular (central banks and commercial and investment banks). Cryptocurrency is a digital currency that is not issued by a central bank and is not based on users' trust in a certain financial entity, because it uses a decentralized ledger system (blockchain technology) and involves a mining process based on solving some hash problems by the computer. This specific Bitcoin mining process is similar to the process of gold extraction Bjerg [8]; Zimmer, [56]; Bibi, [9]; Sapra, N., and Shaikh [39] and investors’ interest in this financial asset is reminiscent of the nineteenth century gold rush. The parallel between gold and cryptocurrencies is not limited only to the impact on the financial market, but also to the externalities generated on the labor market and the environment Maurushat and Halpin, [34]; Dennin, [13]. People’s greed and the desire to obtain spectacular gains in very short periods of time have generated the intensification of the cryptocurrency production process and the ignoring of the negative externalities generated by the mining process (high energy consumption, carbon emissions, electronic waste and consistent frauds). In order to reduce the negative impact on the environment and society, however, concerted actions on the part of the authorities, private companies and portfolio investors are necessary. Crypto-culture encouraged by technical progress that allows novice investors to make transactions with the help of a mobile phone generates fraud among the population with a low level of financial education, and the social repercussions are dramatic Savona, [42]; Dulisse et al. [17]; Biju and Thomas, [7].

The mining is to excavation of cryptocurrencies “through the mathematical operations of a mining machine in the network (i.e., “hash rate”)” Yuan et al. [53]. The mining process requires considerable computational effort, specifically electricity and CPU time and the miners receive a fee as cryptocurrency. Validation of transactions is decentralized, and blockchain technology also offers the advantage of anonymity of the cryptocurrency owners and their transactions.

Launched in 2009, after the international financial crisis, Bitcoin was received with interest considering the failure of public financial policies and the activity of banks that led to the international financial crisis of 2008–2009. Its evolution started to become more and more interesting as certain psychological thresholds were reached, namely the threshold of 1000 USD in 2017, so that by the end of this year it would reach a value of 14,000. Another event of the black swan type, namely the COVID-19 crisis has generated an increasing interest of investors in cryptocurrencies Akbulaev and Abdulhasanov, [2]; Bibi, [9] and digital payments. Despite the reluctance and warnings issued by some central banks such as the Bank of England that drew attention to the risks involved in the use of cryptocurrencies to the detriment of official currencies, some countries, such as El Salvador and South Africa, have adopted Bitcoin as a legal tender and payment instrument. Among all cryptocurrencies, Bitcoin is by far the most used financial asset of this type, maintains the lion’s share of market (Symitsi and Chalvatzis, [46]; Mohsin et al. [33]), which is why this currency was chosen to carry out this study.

In addition to the purely financial aspects that cryptocurrency transactions entail, namely the risks generated by the lack of regulation and supervision, the safe haven status, speculative operations, researchers have also begun to analyze the relationship between Bitcoin and sustainable development and the implications that the mining process has on the environment from the perspective of energy consumption and electronic waste De Vries, [12]; Erdogan et al. [18]. The topics addressed are related to aspects such as Environment, Social and Governance (ESG) aspects, and energy transition Sundaram, [45]; Toumi et al. [50]. There are opinions regarding the positive impact of cryptocurrency transactions on accelerating the improvement of the energy mix by increasing the share of renewable energy Bastian-Pinto et al. [6]; Kumar, [28]; Yüksel et al. [54]; Miśkiewicz et al. [32]; Zheng et al. [55]. The problem of energy consumption generated by cryptocurrency transactions is also of interest from the perspective of central banks that are looking for technical solutions regarding future payment systems. The banking authorities are committed to promoting the principles of digital development, which is why reducing the energy consumption generated by payment systems is a challenge and future digital currencies can use certain technical elements specific to cryptocurrencies Derbali, et al. [14]; Agur et al. [1].

Our research reflects a shifting focus in cryptocurrency research from primarily financial to environmental sustainability concerns. Recent technological advancements like the multi-attention fusion residual convolutional neural network (MAR-CNN) and the deep variational autoencoder (DVAE) are relevant to this type of research. MAR-CNN is an advanced form of CNN that integrates multiple attention mechanisms with residual learning. The attention mechanisms help the network focus on specific features within the data that are most relevant for the task at hand, potentially improving accuracy and efficiency in pattern recognition. In residual learning, the network also learns from the modification of inputs through layers, which helps in combating the problem of vanishing gradients in deep neural networks. As for its applications in cryptocurrency research, MAR-CNN could be used to more accurately model the complex relationships and patterns between various inputs affecting Bitcoin mining energy consumption, such as electricity price, hardware efficiency and transaction volume. Further, it may enhance price prediction models by identifying and focusing on the most impactful variables from historical data, potentially leading to more accurate and robust predictive outcomes.

A DVAE is a type of generative model that learns to represent high-dimensional data in a lower-dimensional latent space. It is used to generate new data instances similar to those on which the model was trained. Variational autoencoders are particularly known for their ability to handle complex distributions and to generate new instances while controlling for specific factors in the data. Its applications in cryptocurrency research are in simulation and forecasting, and anomaly detection. By learning the distribution of variables affecting Bitcoin’s energy consumption, a DVAE may simulate various future scenarios under different conditions, aiding in forecasting and strategic planning. DVAEs could be deployed to detect unusual patterns in energy usage that might indicate inefficiencies or changes in mining technology or strategy.

Given the complex interplay between Bitcoin transactions, energy consumption and carbon emissions, leveraging MAR-CNN and DVAE may significantly enhance the accuracy and depth of analysis. For instance, MAR-CNN could refine the analysis of how specific market variables (like gas prices or inflation) directly impact Bitcoin’s energy consumption by focusing attention on the most relevant features during periods of significant price movement, while DVAE could generate potential future scenarios based on past data, helping to understand how changes in energy prices or regulation might impact Bitcoin mining.

This article focuses on the relationship between Bitcoin transactions and energy consumption. The authors propose a prediction method of the Bitcoin price using a complex Meta-Model (MM) and SQL analytical functions. Building a MM that stacks several ML models regressors as its sub-models brings the following advantages: i) diversity of models—combining different types of models can capture a wide range of patterns in the data and leads to better performance than any single model; ii) error reduction—the MM can learn to correct the errors of the individual sub-models, leading to improved accuracy; iii) robustness—the MM is more robust to overfitting, especially if the sub-models are diverse. Predicting Bitcoin prices is a complex task due to the high volatility and unpredictability of the cryptocurrency market. By using a stacked model, the current approach leverages the strengths of each individual model. For instance, RF captures non-linear relationships, XGB handles outliers well and LGB works efficiently with large datasets.

One contribution of this paper consists of building a dataset that consists of Bitcoin data, energy data and other macroeconomics indicators (the realization of this data set is to be appreciated considering that the data have been collected from several sources, pre-processed and stored into a relational database, which will later allow their use within specific statistical models). Taking in account the plethora of scientific methods like MAR-CNN Yan et al. [51] and the DVAE Yan et al. [52] as potential price predictive or detection model, which can be used as an interdisciplinary application, in this paper we propose a prediction method that embeds the first three categories of the ensemble techniques: bagging (RF), boosting (HGB, LGB, XGB) and voting (VR). The fourth category—stacking is included to use the predictions of the five models as input to another model (that is known as meta-model) that learns from the results of the base models. Another contribution of this paper consists of building features using SQL analytic functions.

This article is structured on specific sections that ensure the presentation of international concerns regarding cryptocurrencies from a financial perspective, but also from a sustainable development view, the authors presenting the results of the main studies from the international scientific literature that allow identifying the research gap.

2 Literature review

The scale of cryptocurrency transactions and the interest of portfolio investors for both speculative and hedging operations were accompanied by the publication of scientific studies that focused on certain aspects related (Fig. 1) to the need to regulate transactions, the status of safe haven for these financial assets or the impact of the Covid-19 crisis on this segment of the financial market Al-Shboul et al. [4]; Wen et al. [58]; Wang et al. [57]. In addition to the strictly financial and legal aspects of these cryptocurrencies, certain studies are focused on the impact that transactions with cryptocurrencies have on sustainable development (by energy consumption, energy transition and electronic waste perspectives), considering the mining process specific to these financial assets. Based on these considerations, certain studies focused the analysis of related risks of conduction mechanism between energy and Bitcoin markets Küfeoğlu and Özkuran, [27]; Li et al. [29]; Gurrib et al. [23]; Yuan et al. [53]. The lack of regulation and supervision accompanied by people’s greed have generated numerous frauds that have mainly affected incipient investors, lacking a solid financial culture Maurushat and Halpin, [34]; Savona, [42]; Thakur, [48].

Fig. 1
figure 1

Main issues

Cryptocurrency transactions have become a challenge for the energy transition process considering the high energy consumption generated by the mining process Goodkind et al. [22]; Náñez Alonso et al. [35]. In addition, in order to face the increasingly intense competition on this market, players need more and more powerful computers, and giving up old computers fuels the waste process and generates new problems related to e-waste management. Having the goal of achieving carbon neutralization assumed by countries through various international treaties, some economies such as China have declared cryptocurrency transactions illegal Yuan et al. [53] because carbon footprints are considerable, the mining process being based on fossil fuels Foteinis, [20], Sarkodie and Owusu, [41], Long et al. [30]; Pagone et al. [36].

Using the quantile connectedness method, Yuan et al. [53] focused on their study on spillover effects among Bitcoin price, hash rate, electricity demand and energy consumption. The researchers draw the conclusions that there is strong relationship between energy consumption and the Bitcoin market, and the risk infection mechanism makes its presence felt. Certain studies have focused on evaluating the energy consumption generated by the mining process specific to cryptocurrencies, with alarming results. Thus, the study carried out by Kohli et al. [26] energy consumption generated by Bitcoin is similar with Sweden and by Ethereum is nearly identical as Romania.

Using a VAR-AGARCH model, Symitsi and Chalvatzis, [46] studied the spillover effects of Bitcoin on clean energy, fossil fuel energy companies and technology companies. The results of this research suggested that there are long-run volatility effects of Bitcoin on energy companies and significant return spillovers from energy to this cryptocurrency. Maiti [31], using a discrete threshold regression mode, focused the research on Bitcoin prices and Bitcoin energy consumption relationship in the interval November 2010 and October 2021. This scholar demonstrated that the impact of energy consumption on cryptocurrency prices is not uniform for the analyzed period.

Corbet et al. [11] focused their study on Bitcoin-energy markets relationship taking in account the growing interest of portfolio investors for cryptocurrencies and difficulties noticed in the mining of these assets. The conclusion of the study is that Bitcoin transactions have an impact on large electricity and utilities markets. So, the demand for energy and emissions of carbon dioxide are rising, these results being registered also by Dogan et al. [15]. Based on bootstrap Granger causal relationship tests, Su et al. [47] investigate the influences between Bitcoin and oil markets. The main conclusions of the study are that investors speculate on the relationship between these two markets in order to build diversified portfolios that ensure risk reduction. Similar results were obtained by Huynh et al. [25], using transferring entropy method for US and European crude oil indices and cryptocurrencies. In addition, the blockchain technology used by Bitcoin, as an essential component of the Fourth Industrial Revolution, can be solution for new technological strategies to promote the cut of international transaction fees.

Using a time-varying Granger causality test for period Sept 17, 2014, to October 12, 2021, Dogan et al. [15] explored the relationship between Bitcoin, energy and carbon emissions in order to analyze the impact of this cryptocurrency on energy transition and the environment. The causal relationship identified between Bitcoin, energy and carbon emissions is essential for tailoring public policies not only on the financial market but also on other components related to the twin transition. This study highlights the need to decarbonize cryptocurrencies using clean energy in mining process, but also to accelerate the digitalization of the energy sector, which can be based on blockchain technology. Sarker et al. [40] used nonlinear ARDL method and the Granger causality test for period 2013–2021 to analyze the asymmetric effects of climate policy uncertainty and energy prices on Bitcoin prices. Researchers draw attention to the impact that price fluctuations on the energy market have on Bitcoin, that is an energy intensive asset. Investors in the cryptocurrency market should be much more attentive to developments on the energy market to better anticipate the trend of these financial assets price.

Fig. 2
figure 2

Main implications of cryptocurrencies transactions on energy sector

So, taking in account the results of these scientific studies, the analysis of the Bitcoin-energy relationship is of particular interest not only from the perspective of the connections that exist between these strategic assets, but also from the point of view of the impact that cryptocurrency transactions have on the energy market (on the price of certain assets and on the price of shares issued by energy companies) and energy transition process (Fig. 2). The high consumption generated by the mining process brings challenges that can determine the attraction of new sources of energy, especially renewables, considering that it is desired to reduce the negative externalities on the environment. In addition, the price prediction for Bitcoin is important to reduce the herd behavior of investors. Considering the energy-Bitcoin relationship, investors can better base their trading decisions on the energy market to obtain certain effects on Bitcoin and to optimize the composition of portfolios that can contain both classic assets (such as oil) and financial assets such as cryptocurrencies Su et al. [47]. Besides the negative externalities on the environment, specialists also analyze the social impact of cryptocurrency mining, considering that the pollution generated has direct repercussions on the health of the population. In this line, Goodkind et al. [22] had launched the concept of crypto damages—as the impact cryptocurrencies has on human health and climate. In conclusion, the blockchain technology used to create bitcoin is considered "primary fuel for the global network of money transmission" Hashemi Joo et al. [24]. The paradox is that "while blockchain can serve us, Bitcoin threatens our survival" Sapra and Shaikh [39].

3 Methodology

The proposed methodology consists of three stages as shown in Fig. 3:

  • Stage 1 – the datasets consisting in resources prices and traded quantities, macroeconomics and Bitcoin data are collected from several sources, pre-processed and stored into a relational database.

  • Stage 2 – an extensive feature engineering stage is performed to extend the initial input with more features and enhance the model with new analytical and statistical variables that lead to the increase of the forecast accuracy.

  • Stage 3 – a set of five ML models are trained and tested, and their predictions are stacked using a meta-model. This model adjusts these predictions with a set of weights to provide the final prediction of the Bitcoin price.

Fig. 3
figure 3

Stages of the proposed methodology

3.1 Stage 1—Input data pre-processing

The data sample interval spans from 1st of January 2019 to 31st of May 2022. In this interval, significant price movements took place. Bull and bear markets explain price trends and are associated with significant price movements. Bull markets are intervals in which the price goes upwards, while the opposite is true for bear markets. To forecast the Bitcoin close price (BTC_USD - \({C}_{BTC}^{h}\)), as the relationship between energy, Bitcoin prices and their volatility became notorious, three main categories of features or variables are considered: 1) Bitcoin data (prices and traded volumes), 2) electricity, gas, oil prices and quantities and 3) macroeconomics (such as: inflation, EUETS price). They were collected from various sources like databases, files and online sources. For transparency and replicability, the input data was stored on the GitHub platform.Footnote 1 These categories consist of 15 fundamental variables that are known in the previous day of forecasting (\(h-24\)) and are used by the ML algorithms to provide the forecast of the Bitcoin close price for the next day (\({C}_{BTC}^{h}\)). Therefore, the initial dataset is composed of: Open-High-Low prices (\({O}_{BTC}^{h-24}, {L}_{BTC}^{h-24}\)), Total volume (\({V}_{BTC}^{h-24}\)), Quote Asset Volume (\({QAV}_{BTC}^{h-24}\)), Number of trades (\({N}_{BTC}^{h-24}\)), Taker base volume (\({TBV}_{BTC}^{h-24}\)), Taker quote volume (\({TQV}_{BTC}^{h-24}\)), Electricity price on DAM (\({P}_{El}^{h-24}\)), Gas price on DAM (\({P}_{Gas}^{h-24}\)), Inflation in EU (\({I}_{EU}^{h-24}\)), EU-ETS emissions certificates prices (\({P}_{EUETS}^{h-24}\)), Oil price (\({P}_{Oil}^{h-24}\)), Electricity traded quantity on DAM (\({Q}_{El}^{h-24}\)), Gas traded quantity on DAM (\({Q}_{Gas}^{h-24}\)). Quote volume is used in sell orders when a trader knows beforehand how much quote coin, he/she will sell. Base volume is used in buy orders when a trader is not aware of how much quote coin, he/she can buy considering the available funds. On a trading exchange, assets are traded in pairs. One asset (Base Asset—BA) is traded against the other (Quote Asset QA). The price indicates how much of the QA is required to buy 1 unit of the BA. A taker BA volume represents how much of the total BA volume is contributed by the taker orders. The total volume is equal to the taker buy plus taker sell.

For pre-processing, we perform the following steps: a) Data cleaning addresses any issues that could compromise the quality of the data analysis. It involves identifying and correcting errors like typographical mistakes, and inconsistencies of the data entries. This step also includes the treatment of missing values through methods like interpolation, where gaps are filled based on surrounding data values. Furthermore, this stage covers the removal of duplicate records that may skew the results of the analysis; b) Data transformation includes changing the data types—for instance, converting timestamps from strings to datetime objects—or aggregating data points, such as summing up hourly transactions to obtain totals, to better suit the analysis needs; c) Data merging and integration combines the datasets from the following sources: Bitcoin trading prices,Footnote 2 Romanian electricity market volumes and prices,Footnote 3 gas volumes and prices,Footnote 4 inflation rates,Footnote 5 oil pricesFootnote 6 and EU-ETS emissions certificates prices.Footnote 7 All variables were recorded at hourly resolution and merged into a single, comprehensive dataset based on timestamp, facilitating coherent analysis across all variables; d) Data partitioning divides the dataset into yearly subsets for conducting time-based analyses and for setting up training and testing sets in ML algorithms. Partitioning helps in evaluating the performance of predictive models under unbiased conditions by training them on one subset of the data and testing them on another; e) Data normalization and standardization involve scaling numerical data to ensure that it falls within a particular range, such as between 0 and 1 (normalization) or having a mean of 0 and a standard deviation of 1 (standardization). Such scaling is critical for ML models that are sensitive to the magnitude of data, ensuring that no variable unduly influences the model due to its scale; f) Data encoding converts categorical data into a numerical format since ML models handle numeric inputs. Techniques like one-hot encoding or label encoding are employed depending on the nature of the categorical data; g) Error checking and validation involves rigorously checking the dataset for errors and validating its accuracy to ensure that the data is fit for ML models. This includes applying specific data validation rules, such as constraints on data values and relationships, to prevent logical inconsistencies in the dataset.

By following these detailed preprocessing steps, the dataset is effectively prepared to be used in Step 2 and enhanced with more derived features. A data sample is showcased in Table A1 in Appendix A.

3.2 Stage 2—Features engineering

The input of the ML algorithms \({X}^{h}\) is initially composed of the 15 raw or fundamental features described and preprocessed in Step 1 that represent the recorded hourly values of the previous day. The hour (\(h\)), month (m), weekday (wd) and year (y) are also extracted from the timestamp and added to the input variables to capture the time variations. For day d of prediction, the fundamental features are lagged by 24 h (h-24).

$$\begin{array}{c}{X}^{h}=\left[{P}_{El}^{h-24}, {Q}_{El}^{h-24}, {P}_{Gas}^{h-24},{Q}_{Gas}^{h-24},{P}_{Oil}^{h-24}, {P}_{EUETS}^{h-24},{I}_{EU}^{h-24}\right.,{O}_{BTC}^{h-24},{H}_{BTC}^{h-24},{L}_{BTC}^{h-24},\\ \left.{N}_{BTC}^{h-24}, {V}_{BTC}^{h-24},{QAV}_{BTC}^{h-24},{TBV}_{BTC}^{h-24}, {TQV}_{BTC}^{h-24},m, h, wd,y\right]\end{array}$$
(1)

Feature engineering focuses on the Bitcoin price moving average, 24, 48, 72-shifted vectors, their mean value and SQL Analytical functions.

3.2.1 Statistical variables

The input is filled with 11 statistical features. Previous hourly prices (\({C}_{BTC}^{h-\Delta t}\)) with a lag (\(\Delta t\)) of 24 to 72 h are calculated by shifting the prices. The averages of the previous hourly prices for 3 consecutive days (\(\overline{{C }_{BTC}^{\Delta t}}\)) are calculated using Eq. (2):

$$\overline{{C }_{BTC}^{\Delta t}}=\frac{\sum_{\Delta t\in \left\{\mathrm{24,48,72}\right\}}{C}_{BTC}^{h-\Delta t}}{3}$$
(2)

The hourly variations of the previous Bitcoin prices for the last 3 consecutive days (\({\delta }_{BTC}^{\Delta t}\)) are determined using Eq. (3):

$${\delta }_{BTC}^{\Delta t}=100-\frac{{C}_{BTC}^{h-\Delta t}}{{C}_{BTC}^{h-\Delta t-24}}\times 100$$
(3)

Moving average refers to a series of averages of fixed size subsets of the total set of observations. It is also known as rolling average with a specified window size (q).

$${MA}_{q}^{t}=\frac{1}{q}\sum_{k=t-q+1}^{t}{C}_{BTC}^{k}$$
(4)

where:

  • t represent the last price of the time series and it is set to \(h-24\)

  • \({ C}_{BTC}^{k}\) represent the values of time series,\(k=\stackrel{-}{t-q+1, t}\)

  • \(q\in \{\mathrm{3,7},\mathrm{10,20,50}\}\) represents the window size.

3.2.2 SQL analytical functions

SQL provides analytical functions like RANK, ROW_NUMBER, LEAD, LAG, and window functions that enable advanced analytical calculations. SQL analytical functions, also known as window functions, perform calculations across a set of rows related to the current row in a dataset. These functions enable calculations beyond simple aggregation and grouping. They are particularly useful for tasks like ranking, cumulative sums, moving averages, etc. Analytical functions are usually used in extracting and reporting on data stored in relational databases and data warehouses. They process data based on groups of records but differ from aggregate or group functions by returning multiple results for each individual group. The group of records to which the analysis is applied is called a window and is defined using an analysis clause. The window determines the range of records to be analyzed for each current record. The size of the window can be determined either physically, by specifying the number of records in the group, or logically, by conditions on the field values. Analytic operations are the last processed in an SQL query before the ORDER BY clause.

The structure of an analytic function is as follows: ANALYTIC FUNCTION () OVER (analytical clause). The analytical clause can have the following subclauses: PARTITION BY (expression1, expression2, etc.) ORDER BY expression/position/alias [ASC/DESC] [null first/last] window clause, where window clause can be: ROWS/RANGE [BETWEEN] {UNBOUNDED PRECEDING}/{CURRENT ROW}/{expression PRECEDING/FOLLOWING} [AND] {UNBOUNDED PRECEDING}/{CURRENT ROW}/{expression PRECEDING/FOLLOWING}.

If the window clause is omitted, then by default it applies RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW. Using the ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING clause determines the analysis of the previous and immediately following value of the current record. A list sample of analytical functions is showcased in Table 1.

Table 1 Examples of analytical functions

Thus, the first three analytical functions (\(F1\div F3\)) – the mean BTC prices from the same year (y) and month (m) (columns in ORDER BY) with the current value from the same hour (column in PARTITION BY) considering the preceding and following n values are depicted in Eq. (5).

$$\begin{array}{c}F1\div F3:AVG(C_{BTC}^h)OVER\;(PARTITION\;BY\;h\\ORDER\;BY\;y,\;m\;ROWS\;BETWEEN\;n\;PRECEDING\;AND\;n\;FOLLOWING)\end{array}$$
(5)

where \(n\in \{\mathrm{1,3},5\}\).

The fourth analytical function (\(F4\)) – the mean BTC prices of previous values relative to the current value from the same year, month, at the same hour—is described in Eq. (6).

$$\begin{array}{c}F4:AVG(C_{BTC}^h)OVER\;(PARTITION\;BY\;h\\ORDER\;BY\;y,\;m\;ROWS\;BETWEEN\;unbounded\;preceding\;AND\;current\;row)\end{array}$$
(6)

The mean BTC prices of next values relative to the current value from the same year, month, at the same hour represent the fifth feature showcased in Eq. (7).

$$\begin{array}{c}F5:AVG(C_{BTC}^h)OVER\;(PARTITION\;BY\;h\\ORDER\;BY\;y,\;m\;ROWS\;BETWEEN\;current\;row\;AND\;unbounded\;following\end{array}$$
(7)

The sixth feature consists of the mean of BTC price from the same month between which there is a ± 5 difference relative to the current value. It is illustrated in Eq. (8).

$$\begin{array}{c}F6:AVG(C_{BTC}^h)OVER\;(PARTITION\;BY\;y,\;m,\;h\\ORDER\;BY\;m\;RANGE\;BETWEEN\;5\;preceding\;AND\;5\;following\end{array}$$
(8)

The sixth feature consists of the mean of BTC price from the same month between which there is a ± 10 difference relative to the current values in Eq. (9).

$$\begin{array}{c}F7:AVG(C_{BTC}^h)OVER\;(PARTITION\;BY\;y,\;m,\;h\\ORDER\;BY\;m\;RANGE\;BETWEEN\;10\;preceding\;AND\;10\;following\end{array}$$
(9)

The eighth and nineth features represent the minimum Bitcoin value and the maximum Bitcoin value from the same hour, with less or equal values relative to the current value as in Eq. (10) and Eq. (11).

$$\begin{array}{c}F8:MIN(C_{BTC}^h)\;OVER\;(PARTITION\;BY\;h\\ORDER\;BY\;y,\;m,\;h\;ROWS\;BETWEEN\;unbounded\;preceding\;AND\;current\;row)\end{array}$$
(10)
$$\begin{array}{c}F9:MIN(C_{BTC}^h)\;OVER\;(PARTITION\;BY\;h\\ORDER\;BY\;y,\;m,\;h\;ROWS\;BETWEEN\;unbounded\;preceding\;AND\;current\;row)\end{array}$$
(11)

The minimum Bitcoin value and the maximum Bitcoin value from the same year, month, hour, with equal or greater values relative to the current value are shown in Eq. (12) and Eq. (13) and represent features F10 and F11.

$$\begin{array}{c}F10:MIN(C_{BTC}^h)\;OVER\;(PARTITION\;BY\;h\\ORDER\;BY\;y,\;m,\;h\;ROWS\;BETWEEN\;unbounded\;preceding\;AND\;current\;row)\end{array}$$
(12)
$$\begin{array}{c}F11:MIN(C_{BTC}^h)\;OVER\;(PARTITION\;BY\;h\\ORDER\;BY\;y,\;m\;,h\;ROWS\;BETWEEN\;current\;row\;AND\;unbounded\;following)\end{array}$$
(13)

The standard deviation of the Bitcoin price from the same year and month (column in ORDER BY) with the current value from the same hour (column in PARTITION BY) represents the twelfth feature and it is given in Eq. (14).

$$\begin{array}{c}F12:STDDEV(C_{BTC}^h)\;OVER\;(PARTITION\;BY\;h\\ORDER\;BY\;y,\;m\;ROWS\;BETWEEN\;1\;preceding\;AND\;1\;following)\end{array}$$
(14)

F13 calculates the Bitcoin price percentile and returns a value that represents the percent of values that are less or equal than the current value as in Eq. (15). F14 calculates the percent rank of the current value within a specific hour as in Eq. (16).

$$F13:CUME\_DIST()\;OVER\;(PARTITION\;BY\;h\;ORDER\;BY\;C_{BTC}^h)$$
(15)
$$F14:PERCENT\_RANK()\;OVER\;(PARTITION\;BY\;h\;ORDER\;BY\;C_{BTC}^h)$$
(16)

F15 computes the ratio of a value to the sum of a set of values as in Eq. (17).

$$F15:RATIO\_TO\_REPORT(C_{BTC}^h)\;OVER\;(PARTITION\;BY\;y,\;m,\;h)$$
(17)

Finally, the input of the ML algorithms is completed with the above-calculated features:

$${X}^{h}=[{X}^{h}, {C}_{BTC}^{h-24},{C}_{BTC}^{h-48},{C}_{BTC}^{h-72},\overline{{C }_{BTC}^{\Delta t}}, {\delta }_{BTC}^{\Delta t}, {MA}_{q}^{t},F1\div F15]$$
(18)

The closing hourly BTC prices represent the target feature (\({y}^{h}={C}_{BTC}^{h}\)) of the ML algorithms.

3.3 Stage 3—Forecasting ML models

A stochastic forecasting method that combines four ensemble ML algorithms: Random Forest (RF), eXtreme Gradient Boosting (XGB), Histogram-based Gradient Boosting (HGB) and Light Gradient Boosting (LGB) Machine using a Voting Regressor (VR) model is proposed in this paper. The proposed model combines the predictions of multiple individual models to make a final prediction, resulting in improved performance and generalization. Therefore, VR combines the predictions of multiple models to make a more accurate prediction than any single model. The idea behind using VR is that different models might capture different aspects of the underlying data patterns, and combining their predictions can lead to a more accurate overall prediction.

The main four steps of implementing a VR are as follows (as in Fig. 4):

  • Step 1—Choose a set of individual regression models to include them in the ensemble. These models can be trained using different algorithms or hyperparameters. The effectiveness of a Voting Regressor depends on the diversity and quality of the individual models included in the ensemble. Experiments with different combinations of models and assessment of the ensemble's performance on a validation dataset are performed.

  • Step 2 – We create an instance of the VR class from the ML library (e.g., scikit-learn in Python) and provide the list of individual models to the VR. When choosing the models, the most accurate models were selected.

  • Steps 3 and 4—Fit the VR on the training dataset (80%), which trains all the individual models. Use the trained VR to make predictions on new data. Test the models for 20% of the dataset.

Fig. 4
figure 4

Steps in setting VR

Ensemble ML algorithms combine the predictions of multiple individual models to create a stronger, more accurate model. They reduce overfitting and increase the robustness of ML models. There are four main categories of ensemble techniques briefly described in Fig. 5.

Light Gradient Boosting Machine (LGB) like other gradient boosting frameworks, builds an ensemble of weak learners (usually decision trees) in a sequential manner and incorporates several optimizations to make it faster and more scalable. Each new tree corrects the errors made by the previous ones, leading to improved predictive performance. It is known for its speed, memory efficiency, and high performance on a wide range of datasets. It uses a histogram-based approach to bucket the data, which reduces memory usage and speeds up training. This approach discretizes the feature values into bins, reducing the number of unique values to consider during the split finding process. LGB utilizes multiple CPU cores for parallel training and supports GPU acceleration to speed up the training process.

Histogram-based Gradient Boosting (HGB) is a technique used in gradient boosting algorithms to improve their efficiency and speed. As mentioned, this technique is a core component of LGB. Traditional gradient boosting algorithms build trees using a depth-wise approach. They iteratively split data points at each level of the tree based on a specific feature’s values. However, this approach can be computationally expensive and memory-intensive, especially with large datasets. HGB as in LGB bins feature values in discrete bins or histograms during the data preprocessing step. Then, during the tree-building process, instead of searching for optimal splits for individual feature values, the algorithm works with the pre-binned histograms.

eXtreme Gradient Boosting (XGB) proved high predictive capabilities and feature-rich implementation. Like LGB, XGB is based on the gradient boosting as it iteratively builds an ensemble of weak learners, and it introduces a regularized learning objective that combines the loss function with penalties that prevent overfitting and improves the generalization of the model. Furthermore, XGB, similarly to LGB, utilizes multiple CPU cores and even distributed computing environments, making it highly scalable and efficient for large datasets and accelerates using GPUs, which significantly speeds up the training process. XGB allows customization of the criteria for finding optimal split points during tree construction.

Fig. 5
figure 5

Four main categories of ensemble methods

Random Forest (RF) is an extension of decision tree algorithms that aims to improve their predictive performance and reduce overfitting. It consists of a collection of individual decision trees. Each tree is trained on a random subset of the training data and independently makes predictions. During the construction of each tree, a random subset of features is considered for splitting at each node, reducing overfitting. For each tree, a random subset of the training data is sampled with replacement. This process is known as bagging. The combination of random feature selection and bagging contributes to the diversity of the trees in the ensemble. For classification, the predictions of each individual tree are combined through a majority vote, while for regression tasks, the predictions are usually averaged. It is less sensitive to outliers and noise in the data compared to single decision trees. The training of individual trees can be parallelized, making Random Forests computationally efficient.

Thus, the proposed model embeds the first three categories of the ensemble techniques: bagging (RF), boosting (HGB, LGB, XGM) and voting (VR). The fourth category—stacking is included in order to use the predictions of the five models as input to another model (that is known as Meta-Model MM) that learns from the results of the base models.

The first training dataset T spans from 1st of January until 30th of April 2021, whereas the first testing dataset spans from 1st of May until 7th of May 2021. The ML algorithms (RF, LGB, HGB, XGB and VR are trained on the \(T\) interval and provide for the next 7 days an individual forecast denoted by \(\widehat{{y}_{p}^{h+\Delta t}}\), where \(\Delta t=\stackrel{-}{\mathrm{1,168}}\) and \(p\in \left\{RF, LGB, HGB, XGB, VR\right\}\). Each individual model provides an estimation. These estimations are further weighted with a set of weights (\({\omega }_{i}\)) and used as input for the stacking ML model. This model is a Meta-Model (MM) that mediates the predictions of the sub-models using the weights to improve the accuracy of the final prediction. Instead of training the MM on the input set \({X}^{h}\), it is trained on the predictions \(\left(\widehat{{y}_{p}^{h}}\right)\) of its sub-models using the same target (\({y}^{h}={C}_{BTC}^{h}\)) for the same training period as the sub-models. Thus, it determines the weights to adjust each sub-model and learns how to optimally combine these predictions. The goal is to leverage the strengths of each individual model and mitigate their weaknesses, thereby enhancing prediction accuracy. After training, the predictions \(\left(\widehat{{y}_{p}^{h+\Delta t}}\right)\) of the initial five ML models are weighted with the corresponding coefficient to forecast the hourly Bitcoin price \(\left(\widehat{{C}_{BTC}^{h+\Delta t}}\right)\) for the next 7 days:

$$\widehat{{C}_{BTC}^{h+\Delta t}}=\sum_{p}{\omega }_{p}\times \widehat{{y}_{p}^{h+\Delta t}},\forall p\in \left\{RF, LGB, HGB, XGB, VR\right\},\Delta t=\stackrel{-}{\mathrm{1,168}}$$
(19)

The stacking ML model can be a simpler ML model such as Linear Regression (LR) or Decision Tree (DT) regressor or another ensemble model, such as Gradient Boosting Regressor (GBR). Therefore, the individual estimations are used as input features in order to obtain a final prediction using a stacking model, such as LR or DT. In the stacking approach, each sub- model’s prediction is given a specific weight, which signifies the relative importance or trustworthiness of that model’s output in the context of the combined prediction. These weights are critical as they determine how much influence each model’s prediction has on the final output. To determine the weights, the method of least squares errors is a common objective function in regression problems. The least squares error function quantifies the difference between the observed values and the predicted values. Therefore, the weights are obtained by minimizing the Sum of the Squared Errors (SSE) between the actual target or the Bitcoin prices during the training interval and the stacked predictions p. By minimizing this sum, the fitting process seeks to find the model parameters (weights in this case) that result in the best possible predictions, in terms of being closest to the actual data (Bitcoin close price).

$${\omega }_{p}=\underset{{\omega }_{p}}{{\text{argmin}}}\sum_{h\in T}{\left({C}_{BTC}^{h}-\sum_{p}{\omega }_{p}\times \widehat{{y}_{p}^{h}}\right)}^{2}$$
(20)

Using SSE has several advantages: i) it is straightforward to implement and computationally efficient to optimize, which is particularly valuable when dealing with multiple predictors as in stacking; ii) SSE function is convex in terms of the regression coefficients (weights), ensuring that the optimization process finds a global minimum, thus the optimal set of weights; iii) squaring the errors penalizes larger discrepancies more severely, focusing the model on avoiding large mistakes in prediction. By optimizing these weights to minimize SSE, the stacking model effectively learns the best way to combine the sub-models’ outputs to replicate the actual Bitcoin prices as closely as possible. This results in a robust model that improves upon the performance of its constituent models, leading to more reliable and accurate forecasts.

Ensemble methods, like RF, XGB, LGB, HGB and VR, are advanced ML techniques known for their high accuracy and robustness. They have different parameters and structures. RF consists of a collection of decision trees. Each tree is built from a random subset of the training data. The key parameters are: number of trees, max depth of trees, min samples split, min samples leaf. Each tree makes a prediction, and the final output is typically the average of these predictions. XGB is a gradient boosting framework that uses a collection of decision trees. Its key parameters are: number of boosting rounds, max depth of trees, learning rate, subsample ratio of the training instance. It uses a more regularized model formalization to control over-fitting, which gives it better performance. LGB structure is similar to XGB, but uses a histogram-based algorithm for faster training and reduced memory usage. Its main parameters are: number of leaves, max depth, learning rate, feature fraction. HGB is a gradient boosting approach that uses histograms to represent the continuous feature values in each split. Its key parameters are: max iter (number of boosting stages), max depth, learning rate. HGB is designed to be faster than traditional gradient boosting by using histograms to speed up the calculation of potential splits. VR is not a tree-based model, but an ensemble that combines predictions from multiple different regression models. Its key parameter depends on the individual regressors used within the ensemble. The final prediction can be either the average or a weighted average of all the regressors’ predictions. In ensemble methods, the focus is more on how the individual models (like trees in RF or boosting rounds in XGB) are combined and optimized for the best predictive performance.

3.4 Evaluation of the accuracy of the models

For assessing the accuracy of the stacking model, the following well-known metrics are calculated for the training and testing intervals: Root-Mean Squared Error (RMSE), coefficient of determination (\({R}^{2}\)), Mean Absolute Percentage Error (MAPE) and Mean Absolute Error (MAE):

$$RMSE=\frac{1}{T}\sum\limits_{h=1}^{T}{\left({C}_{BTC}^{h}-\widehat{{C}_{BTC}^{h}}\right)}^{2}$$
(21)
$${R}^{2}=1-\frac{\sum_{h=1}^{T}{({C}_{BTC}^{h}-\widehat{{C}_{BTC}^{h}})}^{2}}{\sum_{h=1}^{T}{\left({C}_{BTC}^{h}- \overline{{C }_{BTC}^{h}}\right)}^{2}}$$
(22)
$$MAPE=\frac{1}{T}\sum_{h=1}^{T}\frac{\left|{C}_{BTC}^{h}-\widehat{{C}_{BTC}^{h}}\right|}{\left|{C}_{BTC}^{h}\right|}\times 100\%$$
(23)
$$MAE=\frac{1}{T}\sum_{h=1}^{T}\left|{C}_{BTC}^{h}-\widehat{{C}_{BTC}^{h}}\right|$$
(24)

The same metrics are used to evaluate the accuracy of the ML models by replacing the \(\widehat{{C}_{BTC}^{h}}\) with the corresponding predictions \(\widehat{{y}_{p}^{h}}\), where \(p\in \left\{RF, LGB, HGB, XGB, VR\right\}\).

4 Results

4.1 Case study description

The input data was collected from various websites. For Bitcoin data, energy data and macroeconomics (oil prices and inflation) several websites were visited, and the values were either downloaded or scraped, as mentioned in subsection 3.1. For instance, the electricity data was scraped from OPCOM website. The Bitcoin price and traded volume variations are depicted as boxplots in Fig. 6. Usually, according to the interquartile range, the price varied between 1,000 and 40,000 USD. The median price was just over 1,000 USD, but it reached almost 70,000 USD for short intervals. The variation of the traded volume was much less than that of price, but outliers were more frequent.

Fig. 6
figure 6

Variations of Bitcoin price and volume during January 2019-May 2022

The correlations between Bitcoin price and other prices and macroeconomics indicators are analyzed in Fig. 7. Even from 2019, when the Bitcoin price was much lower, a strong correlation between the price and the Price_EUETS was recorded (0.65). Furthermore, a strong inverse correlation was noticed between Inflation_EU and the price. There was no correlation between the electricity price on DAM and the price (0.03), and the correlation between gas price on DAM and the price was 0.35. The other correlations in 2019 were of medium or weak intensity (as in Fig. 7a). In 2020, the correlations between the Bitcoin price and electricity (0.39) and gas prices (0.40) on DAM intensified (as in Fig. 7b). The strong correlation between the price and Price_EUETS maintained (0.68), while the inverse correlation with the Inflation decreased from -0.71 in 2019 to -0.55 in 2020. The weak correlation with the oil price changed the polarity from -0.20 in 2019 to 0.30 in 2020.

Fig. 7
figure 7figure 7

Heatmaps (a) 2019, (b) 2020, (c) 2021, (d) 2022

In relation to energy prices, in 2021, the Bitcoin price showcased ample swings (Fig. 7c). Most of the correlations were of medium intensity (Gas_quantity_DAM switched from -0.25 in 2020 to 0.43 in 2021, Inflation_EU switched from -0.55 in 2020 to 0.41 in 2021). The stronger correlation with Price_EUETS from 2019 and 2020 weakened from 0.68 in 2020 to 0.24 in 2021. In the first five months from 2022, the absent correlation between the price and the electricity price on DAM returned (-0.09). A medium correlation with Inflation_EU (-0.41) was noticeable, while the rest of the correlations were weak (as in Fig. 7d).

The evolution of Bitcoin price and the Price_EUETS is showcased in Fig. 8. They both started to increase from the end of 2020. The highest values recorded for the Bitcoin price (the blue curve) in 2021 were followed in 2022 by the highest values recorded for the Price_EUETS (the green curve). The evolution of Bitcoin price and oil price is showcased in Fig. 9. While the oil price was much higher than the Bitcoin price in 2019, they met in the first semester of 2020 when the oil price dropped at the beginning of COVID-19 pandemic, and both started to increase. The maximum values recorded by the Bitcoin prices in the last semester of 2021 were followed at the beginning of 2022 by the maximum values of the oil price.

Fig. 8
figure 8

Evolution of Bitcoin price and Price_EUETS

Fig. 9
figure 9

Evolution of Bitcoin price and oil price

The basic statistics applied on the fundamental features are presented in Appendix A in Tables A2-A6. The standard deviation was around 2,643 in 2019, almost doubled in 2020 and then was more than double in 2021 when the Bitcoin price reached a maximum value. However, the standard deviation increased 4 times from 2020 to 2021 in the case of the electricity price, whereas for the gas price, it increased more than 10 times. Impressive increases in standard deviation occurred for other input variables as illustrated in Appendix A.

The first considerable peak price was recorded in March 2021 – also known as the first bull market, but it was followed by the first bear market in May 2021 (as in Fig. 9). In August 2021, the Bitcoin price started its second upward slope that continued with the third upward slope in October 2021. However, in November 2021, the price reached the highest value and then went back to the average price level in September. Therefore, four intervals (entire months) are studied in the current paper: May and November—bear markets and August and October—bull markets.

4.2 Simulations

The training interval spanned from 1st of January 2019 until the day before the prediction horizon that is set for 168 h ahead or a week. For simulations, we focus on two upward and two downward slopes. Apart from the statistical variables, the analytical functions are implemented in Oracle 12c. Their implementation is briefly described in Table 2.

Table 2 Implementation of the analytical functions

For the input variables selection, we tested SelectKBest method from sklearn.feature_selection, but no significant improvement was recorded, thus, the entire input variables set (that consists of 41 variables: 15 fundamental, 11 statistical and 15 SQL analytical functions) was used in simulations. The standard 80:20 split was employed for training and testing. Although alternative ratios such as 60:40, 70:30, 75:25, 85:15, and 90:10 were explored, the 80:20 ratio demonstrated the most effective results. One of the most interesting months in 2021 from the Bitcoin price evolution point of view were: May, August, October and November. The first significant downward slope (when the prices dropped from almost 59,000 USD to 34,000 USD) that is assimilated to a bearish market that is analyzed in the current paper refers to month May 2021. The first training interval spanned from January 2019 to 30 April 2021. The prediction is tested during the following weeks: 1–7, 8–14, 15–21, 22–28 May, 29 May – 4 June. The results are graphically presented on a weekly basis (Fig. 10). BTC_USD represents the prices (blue curve), whereas BTC_price_F represents the average forecast with the results of the 5 ML algorithms (orange curve) and BTC_price_PF represents the weighted forecast (green curve) as described in Eqs. (19, 20).

Fig. 10
figure 10

The first downward slope – May 2021

By the middle of the first week of May, the price showed signs of decline. It went from almost 59,000 to 53,000 USD, but it recovered by the end of the week. In the next three weeks, the Bitcoin price continued to go down and it stabilized around 37,000 USD at the beginning of June. From the first analyzed month, one can notice that most of the time, the real curve is well followed by the prediction obtained by averaging the results of the five predictors or by stacking the results using the decision tree regressor (green) curve. However, abrupt slopes (drops or peaks) are difficult to predict. For instance, the sudden drop from the first day of the last week (29 May – 04 June) of almost 2,000 USD is not well predicted or the model fails to provide an accurate forecast.

The first upward slope analyzed in the current paper was recorded in August 2021. The first training interval spanned from January 2019 to 31 July 2021. The prediction is tested during the following weeks: 1–7, 8–14, 15–21, 22–28 August, 29 August – 4 September. The results are graphically presented on a weekly basis (Fig. 11).

Fig. 11
figure 11

The first upward slope – August 2021

During August 2021, the Bitcoin price suffered significant oscillations. During the first two weeks it recorded ups and downs, but by the end of the third week, it reached again the 50,000 USD threshold. The next two weeks were characterized by ups and downs but at the beginning of September, the price was again around 50,000 USD. During August, the prediction is also good. The green and orange curves most of the time followed the real price. Sudden drops like in the first day of the second week of almost 2,000 USD or the sudden increase in the last week were difficult to predict.

The second upward slope was recorded in Oct 2021. The first training interval spanned from January 2019 to 30 September 2021. The prediction is tested during the following weeks: 1–7, 8–14, 15–21, 22–28 October, 29 October – 4 November. The results are graphically presented on a weekly basis (Fig. 12). In the first week of October, the price increased from almost 45,500 to 55,000 USD clearly indicating a bullish market. After the second week, the Bitcoin price went up to more than 59,000 USD (reaching the value recorded at the begging of May). The prediction in the first two weeks is very good, the real price was closely followed by the prediction curves.

Fig. 12
figure 12

The second upward—October 2021

In the third week of October, the price continued to increase up to almost 67,000 USD. However, the sudden increase from 64,000 to 67,000 USD is difficult to predict. In the next week (the fourth week in October), only one noticeable drop to almost 58,000 USD took place, but the price recovered in a day or two and it stabilized at 62,000 USD at the beginning of November.

The second downward slope was recorded in November 2021 after the second week when the maximum value was recorded (around 69,000 USD) and then decreased by more than 20,000 USD and at the beginning of December it valued 48,000 USD. The first training interval spanned from January 2019 to 31 October 2021. The prediction is tested during the following weeks: 1–7, 8–14, 15–21, 22–28 November, 29 November – 5 December. The results are graphically presented on a weekly basis (Fig. 13).

Fig. 13
figure 13

The second downward slope – November 2021

The prediction for November is again very good. Only several days of sudden ups and downs (very limited intervals) raise prediction issues when price variations were on a steep slope. In any case, upon the return from these sudden price movements, the prediction continued to maintain the trend.

The numerical results are illustrated in Tables 3, 4, 5, 6.

Table 3 Metrics for the first downward slope (May 2021)
Table 4 Metrics for the first upward slope (August 2021)
Table 5 Metrics for the second upward slope (October 2021)
Table 6 Metrics for the second downward slope (November 2021)

In Table 7, a comparison between the proposed Meta-Model (MM) and the five individual ML algorithms (RF, LGB, HGB, XGB and VR) is provided. The feature engineering is identical and on average, MAE improves by 7.42% and RMSE improves by 3.25% using the MM. However, without the proposed feature engineering (statistical variables and SQL analytical functions), MAE improves by 31.98% and RMSE improves by 35.55% using the MM.

Table 7 Comparison between MM and the five individual ML algorithms

The following key parameters were considered in simulations (as in Table 8):

Table 8 Key parameters

5 Conclusions

This study focuses on the importance of Bitcoin in the world economy, from the perspective of the relationship with energy consumption. The interest of investors, researchers, public authorities for Bitcoin and in general for cryptocurrencies is growing considering the multiple values that Bitcoin has and its role as a star on the financial market despite its volatility and lack of regulation. The innovation process on the financial market is very intense, but by far, cryptocurrencies are considered the most significant financial innovation that brings together new elements both from an economic and technical point of view. Blockchain technology, which is the basis of cryptocurrencies, is of great interest for other fields as well, given its potential to transform several industries in the context of the twin transition.

Bitcoin price prediction is essential from the perspective of investors who are looking for solutions to optimize the structure of portfolios, but also to reduce the herd behavior that is specific to markets under the sign of the bear. Researchers’ attention has gradually shifted from purely financial aspects related to Bitcoin trading, namely the growing volatility, interdependence with other segments of the financial market, the need to regulate the issuance and trading of these assets to sustainability issues like energy consumption and carbon emissions that generate cryptocurrency mining.

The Bitcoin-energy relationship is important both from the perspective of investors who, based on the evolution of energy prices, can predict the price of this cryptocurrency, but also of public authorities who are increasingly concerned about twin transition. On the one hand, the mining process specific to cryptocurrencies has implications on the energy transition through the reconsideration of nuclear energy and the orientation towards renewable energy to reduce the negative externalities on the environment. On the other hand, blockchain technology specific to cryptocurrencies can be a solution for the digitization of the energy market that faces the problems generated by the production of renewable energy that comes with specific challenges related to intermittent production and the need to store surplus energy.

The proposed prediction using the Meta-Model (MM) for Bitcoin prices was rigorously tested during periods of high volatility and strong market fluctuations. These testing intervals were chosen based on intervals when Bitcoin experienced substantial price shifts. Specifically, the MM was assessed during the months when Bitcoin’s value saw notable declines, such as in May and November, where prices fell from approximately $59,000 to $34,000 and from $68,000 to $46,000, respectively. Additionally, periods of significant price increases were also considered, like in August and October, where Bitcoin’s value rose from around $38,000 to over $50,000 and from $46,000 to $67,000. To ensure the model’s robustness and to mitigate the influence of chance, its forecasting ability was evaluated across a 16-week timeframe. Moreover, to compare the results of the proposed MM and the individual models (RF, LGB, XGB, HGB and VR), the testing interval span over the entire year.

By stacking the ensemble ML models and with the newly added features, on average, the RMSE improved by 35.55% and MAE improved by 31.98% compared to the case with individual models and only fundamental variables. Nevertheless, when the feature engineering is identical, MAE improves by 7.42% and RMSE improves by 3.25% proving the superiority of the proposed MM.

Ensemble models are valuable because they take advantage of the diversity of models’ predictions, leading to improved generalization and better performance. However, it is important to note that while the proposed ensemble model significantly enhances accuracy, it further increases complexity and requires more computational resources. For instance, RF trains multiple trees and storing them can be memory-intensive, and thus training large ensembles can require significant computation. Additionally, finding the right mix of models and hyperparameters for an ensemble involves trial and error steps.

Predicting the future price of Bitcoin, the world’s most famous cryptocurrency, remains a challenging endeavor, particularly within a short forecasting horizon of 1 to 7 days. Its highly volatile nature, coupled with a multitude of influencing factors, poses significant challenges in accurately forecasting its trajectory. One of the primary obstacles lies in Bitcoin’s inherent volatility. Its price is prone to sharp swings, often defying conventional market patterns. For instance, while the situation remained relatively stable for an extended period, from March to October 2023, a significant change occurred in November. During this month, there was a rapid Bitcoin price escalation, leading to the current bullish phase. This unpredictability stems from its decentralized nature, lack of regulatory oversight and the involvement of various global factors, making it difficult to establish a consistent relationship between price and its underlying factors. Another challenge is the vast array of factors that influence Bitcoin’s price. The complexity of data analysis further compounds the difficulty of predicting Bitcoin’s price. The sheer volume and diversity of data from various sources necessitate sophisticated data collection and pre-processing techniques to extract meaningful insights.

Moreover, the dynamic nature of the cryptocurrency market introduces additional challenges. As Bitcoin’s adoption and usage grow, the market becomes more interconnected, with events in one region potentially influencing prices globally. This interconnectedness can amplify the impact of unexpected events, making it difficult to predict their precise effect on Bitcoin’s price. Despite these challenges, researchers and analysts are constantly exploring new methods and techniques to improve Bitcoin price prediction accuracy. ML algorithms, with their ability to analyze vast amounts of data and identify complex patterns, are gaining traction in this field.

In conclusion, predicting Bitcoin’s price within a short forecasting horizon of 1 to 7 days is a challenging task due to its volatility, the multitude of influencing factors and the complexity of data analysis. In our upcoming work, we aim to broaden the scope of our initial dataset by incorporating additional variables. These include sentiment analysis of news and specialized platforms, along with the identification of speculative trends using natural language processing techniques, to provide a more comprehensive view of Bitcoin’s price dynamics.