Bitcoin volatility in bull vs. bear market-insights from analyzing on-chain metrics and Twitter posts

Cryptocurrencies have emerged as a popular investment vehicle, prompting numerous efforts to predict market trends and identify metrics that signal periods of volatility. One promising approach involves leveraging on-chain data, which is unique to cryptocurrencies. On-chain data, extracted directly from the blockchain, provides valuable information, such as the hash rate, total transactions, or the total number of addresses that hold a specified amount of cryptocurrency. Some studies have also explored the relationship between social media sentiment and Bitcoin, using data from platforms such as Twitter and Google Trends. However, the quality of Twitter sentiment analysis has been lackluster due to suboptimal extraction techniques. This research proposes a novel approach that combines a superior sentiment analysis technique with various on-chain metrics to improve predictions using a deep learning architecture based on long-short term memory (LSTM). The proposed model predicts outcomes for multiple time horizons, ranging from one day to 14 days, and outperforms the Martingale (random walk) approach by over 9%, as measured by the mean absolute percentage error metric, as well as recent results reported in literature. To the best of our knowledge, this study may be among the first to employ this combination of techniques to improve cryptocurrency market prediction.


INTRODUCTION
Blockchain has revolutionized the way people think about money, finance, governance, healthcare, technology, and many other fields (Chohan, 2017;Szabo, 2005;Satoshi Nakamoto Institute, 2004;Dai, 1998;Lamport, Shostak & Pease, 1982).The past decade has seen this transformative technology come into the limelight and create entire industries that are now worth upwards of billions of dollars (Department of Industry, Science, Energy and Resources, 2020).As such, blockchain technology has generated great interest, both in industry and academia, with price prediction of different cryptos being one of the most studied topics (Huang, Huang & Ni, 2019).The objective of this article is to contribute to the existing body of research on the prediction of cryptocurrency prices.The study seeks to enhance understanding of the underlying mechanisms that influence fluctuations in crypto assets' prices.Additionally, the article seeks to elucidate the similarities and differences between the crypto market and traditional financial markets.Furthermore, the investigation intends to develop high-performance prediction models that can facilitate the generation of wealth by financial experts.The findings can also assist regulators in comprehending the mechanisms that drive crypto assets, thereby enabling the drafting of better regulation.
Since its inception, Bitcoin (Nakamoto, 2008) has been viewed by some as a lucrative investment opportunity for early adopters willing to take on high risks.Although its volatility has deterred some potential investors, others recognize its potential for significant upside gains.Bitcoin has been widely touted by its supporters as a potential alternative to gold, believed to be a hedge against inflation, and considered to have played a significant role in the financial advancements of the 21st century.While other applications remain important, the investment potential of cryptocurrencies is their most important quality at the time of writing and the main trait that is studied in this article.
Price analysis and prediction of cryptocurrencies are an active research field, in academia and in industry.The importance of price predictors was highlighted by Kliestik et al. (2020), who showed that predictors can be used to assess financial health and eliminate potential risks.Morales, Gray & Rajmil (2022) and Mohan et al. (2023) aim to address FinTech specific challenges by leveraging advanced techniques, such as machine learning and optimization algorithms, to improve accuracy and efficiency in areas like financial crisis prediction and risk assessment.Additionally, their findings underscore the importance of a robust regulatory framework to ensure effective FinTech governance and sustainable growth in the face of rapid industry development.Cryptocurrencies are also exposed to risks, as presented by Schinckus, Nguyen & Chong (2021).The authors found that there is a significant relationship between pseudonymous currencies like Bitcoin or Ethereum (Buterin, 2015) and anonymous cryptocurrencies.DASH is identified as a key cryptocurrency that could be involved in the dynamics of Bitcoin and Ethereum.Prediction systems can help solve these issues by offering a better understanding of the evolution of different phenomena and their inner workings.To this end, much research has been done on the task of predicting asset prices.
The work presented in this article builds on the research done by Shen, Urquhart & Wang (2019), which has shown that Twitter volume is a superior predictor of Bitcoin price compared to Google Trends, and the work of Sattarov et al. (2020), who analyzed the correlation between Bitcoin and Twitter sentiment and built a random forest (RF) predictor that achieved a reported accuracy of 63%.More recently, Critien, Gatt & Ellul (2022) integrated both Twitter sentiment and volume to predict the direction of the price of Bitcoin.An interesting note to make is that both Sattarov et al. (2020) and Critien, Gatt & Ellul (2022) used Valence Aware Dictionary and Sentiment Reasoner (VADER) (Hutto & Gilbert, 2014) to extract sentiment from Twitter data, which is a lexicon and rule-based analyzer.Besides Twitter data, on-chain metrics have also been employed in cryptocurrency price prediction systems.Jagannath et al. (2021) used 26 on-chain metrics to train a long short-term memory (Hochreiter & Schmidhuber, 1997) architecture for Ethereum price prediction.This article advances recent research by employing a more advanced sentiment extraction method (Lecun et al., 1998).To our knowledge, it is the first to concurrently use a larger set of on-chain metrics and sentiment data from Twitter for optimal prediction results.We seek to improve the work done by Jagannath et al. (2021) by adding more than double the on-chain metrics to the analysis, 54 compared to 26, and by expanding the study of the relationship between these metrics and Bitcoin.To assess the efficiency of our approach, the following research questions are postulated: RQ 1.What are the on-chain metrics that exert the most influence on the Bitcoin price and how many of these metrics can signal a 5% variation of price?
RQ 2: Is the influence of Twitter sentiment and on-chain metrics on Bitcoin price uniform across different market conditions (e.g., bull markets, bear markets, stable periods)?RQ 3. To what extent does Twitter sentiment influence Bitcoin price and what is the lag between sentiment and price?RQ 4: How does the combination of on-chain metrics and Twitter sentiment improve the accuracy of Bitcoin price prediction models?
The article is structured as follows: We begin by discussing recent and relevant related works and propose our research questions.Next, we outline the methodology employed in the study.This is followed by a presentation of the data sets used, as well as the necessary transformations.We then detail the experimental setup, which leads into a comprehensive analysis of the results and associated discussion.To conclude, we explore the theoretical contributions, managerial implications, limitations, and potential avenues for future research.

Related works
Technical analysis (TA) is a methodology that uses historical data, like stock price and volume, to anticipate future price movements (Lo, Mamaysky & Wang, 2000).Svogun & Bazán-Palomino (2022), by using TA, found that bubble periods increased the likelihood of Ethereum, Ripple, and Litecoin beating buy-and-hold, but less so for Bitcoin and Bitcoin Cash.Additionally, transaction costs decreased this likelihood for Ripple and Litecoin, but increased it for Bitcoin and Ethereum.The findings suggest that transaction costs exert a stronger influence on profitability in shorter timeframes, like 1 min, but this influence diminishes in longer timeframes, such as a day.Therefore, while TA has been effective in predicting Bitcoin prices in the short term, further research is necessary to better understand its effectiveness in longer time spans, such as 1 day or several days.
In addition to TA, there is another type of analysis that is exclusive to blockchain currencies, on-chain analysis.This technique allows the use of blockchain data, such as hash rate, block height, or transaction volume, to determine future prices.On-chain metrics have proven to offer valuable information about Bitcoin and recent studies have validated their importance.Researchers have approached on-chain analysis as a method to improve prediction performance.One early study integrated blockchain information into a Bayesian neural network (BNN) (Jang & Lee, 2018).Some of the on-chain data used in the study was average block size, transactions per block, hash rate, difficulty, miners' revenue, and cost % of a transaction.The authors also included in their study macroeconomic indicators, like the S&P 500, and global currency exchange rates with the USD.Another study used on-chain data to characterize the Bitcoin and Ethereum markets and make price predictions (Saad & Mohaisen, 2018).The authors used public APIs to collect the blockchain data of both currencies.For each asset, 10 on-chain features were extracted, such as hash rate, miners' revenue, difficulty, or transaction fee.For prediction, the authors employed three approaches: regression, LSTM and conjugate gradient.Jay et al. (2020) proposed a stochastic model that showed improvements over deterministic models.By introducing randomness into the neural network, the authors were able to achieve better results.The training data for the model were composed of 23 features, extracted from the blockchain and from Twitter and Google Trends.The authors used Twitter and Google search volume to quantify market sentiment.
A similar approach was implemented by Wang, Shen & Li (2022).The article investigates the role of investor attention in affecting Bitcoin prices and returns, leveraging LSTM for the analysis.It introduces an aggregate proxy for investor attention that combines both direct and indirect indicators.The empirical findings reveal that incorporating attention variables can significantly improve the predictive accuracy of LSTMs in forecasting Bitcoin returns.Among these attention variables, direct proxies like Google Trends and Tweets appear to offer more valuable information for enhancing the model's forecasting capabilities.
A recent study applied an on-chain approach to predict Ethereum prices (Jagannath et al., 2021).The authors seem to be the first to use self-adaptive algorithms in deep learning in conjunction with on-chain data to predict the price evolution of cryptocurrencies.The research used 26 on-chain metrics and developed an LSTM model using three optimization techniques: L-SHADE optimization algorithm (Tanabe & Fukunaga, 2014), jSO optimization algorithm (Brest et al., 2006) and multi-populationbased ensemble of mutation strategies (Wu et al., 2016).The authors concluded that onchain metrics are a good supplementary tool to existing deep learning techniques when it comes to cryptocurrency price prediction.Most recently, Chen (2023) developed a Bitcoin price prediction system using an RF model and 47 metrics, divided into eight categories: Bitcoin price variables, technical features of Bitcoin, other cryptocurrencies, commodities, market index, foreign exchange, public attention, and dummy variables of the week.The model was trained on two periods, one ranging from April 2015 to October 2018 and the other from October 2018 to April 2022.The author showed that the RF model achieved results superior to those of an LSTM model.Due to the recency of the article and the improved performance of the presented approach, the results reported in this article will be used to benchmark the Proposed Approach in our article.
Twitter sentiment has also been previously used in literature, with varying degrees of success.Mittal et al. (2019) predicted short-term Bitcoin price fluctuation by implementing web search and social media data.The authors found that while Google Trends and Twitter volume were correlated with short term price volatility, Twitter sentiment did not seem to have much of an effect.The authors used VADER to extract the sentiment from the tweets.Twitter volume was again shown in another study to be effective in predicting Bitcoin price, to the detriment of Google Trends (Shen, Urquhart & Wang, 2019).The authors demonstrated that volatility and the next day trading volume were driven by the volume of tweets on Bitcoin.
One study found that linguistic features extracted from tweets can be used to improve the prediction of sudden changes in cryptocurrency prices (Sekioka, Hatano & Nishiyama, 2023).The study used Sentence-BERT to create features from tweets and trained a lightgradient boosting machine (LightGBM) model to predict price changes.The results showed that the linguistic features were able to improve the prediction accuracy, suggesting that social media data can be a valuable source of information for predicting cryptocurrency trends.
Researchers also studied the effect of COVID-19 on social media sentiment and Bitcoin price volatility.Bejaoui et al. (2021) focused on understanding the intricate relationships between Bitcoin prices, social media metrics, and the COVID-19 pandemic.Utilizing various statistical models, including fractional autoregressive vector models and fractional error correction models, the article analyzes daily data from December 31, 2019, to October 30, 2020.The findings revealed both short-term and long-term connections between Bitcoin prices, social media activity (measured through Tweets and Google Trends), and the severity of the COVID-19 crisis.The article noted that the pandemic appears to have encouraged investment in digital currencies like Bitcoin.
Another article that tackled the COVID-19 pandemic (Bouteska, Mefteh-Wali & Dang, 2022) investigated the influence of investor sentiment on Bitcoin returns, utilizing a sentiment index crafted through computational text analysis and principal component analysis (PCA).The authors applied vector autoregressive analysis among other methodologies to explore the relationship between this sentiment index and Bitcoin returns.Their findings suggest that investor sentiment is a powerful predictor of shortterm cryptocurrency market returns.Additionally, the research confirms that during the COVID-19 pandemic, investors' sentiments had a significant impact on Bitcoin returns.The authors state that the sentiment index can enable investors to generate excess returns if used for predictive purposes.
Besides Twitter or Google Trends, other sources of sentiment have been used in research.One article examined the correlation between investor sentiment expressed on StockTwits, a social media platform for investors, and intraday Bitcoin returns (Guegan & Renault, 2021).Through analysis of around one million messages, the study found a statistically significant relationship between investor sentiment and Bitcoin returns for frequencies up to 15 min.Beyond this timeframe, the relationship becomes insignificant.The study also noted that the influence of sentiment on returns is particularly prominent around the period of the Bitcoin bubble.Despite these findings, the effect's magnitude is deemed too small to enable traders to make economic profits based solely on social media information.
Another article delved into the impact of media coverage on Bitcoin market dynamics, particularly focusing on its role in bubble formation (Li et al., 2022).Three key insights are gleaned from the research.First, any media coverage, irrespective of its tone, boosts Bitcoin returns the next day during a bubble period but not otherwise.Second, Bitcoin returns can themselves forecast the extent of subsequent media coverage in both bubble and non-bubble periods.Lastly, the relationship between media coverage and Bitcoin's next-day trading volume is insignificant during bubble periods but negatively correlated in nonbubble times.
A study by Gherghina & Simionescu (2023) investigated the asymmetric effect of COVID-19 pandemic news on the cryptocurrency market.Using daily data from January 2020 to September 2021, the authors found that both adverse and optimistic news had the same effect on Bitcoin returns, indicating that fear of missing out behavior does not prevail.The analysis also showed that both positive and negative shocks in pandemic indices promote Bitcoin's daily changes, suggesting that Bitcoin is resistant to the pandemic crisis and may serve as a hedge during market turmoil.The empirical results indicate that pandemic news could significantly influence Bitcoin's price.
Another study examined the impact of investor attention due to the COVID-19 pandemic, Twitter-based sentiment towards uncertainty and public sentiment on the performance of cryptocurrencies (Bashir & Kumar, 2023).The authors used simple linear regression, quantile regression, the exponential generalized autoregressive conditional heteroskedasticity (EGARCH) model, and sentiment analysis to examine this phenomenon.They found that investor attention and Twitter uncertainty have a negative effect on cryptocurrency returns.The quantile regression results indicated that the effect of investor attention and Twitter economic uncertainty on cryptocurrency returns is heterogeneous, with a higher effect in the lower quantiles.The findings suggest that cryptocurrencies failed to act as a haven during the COVID-19 pandemic.These findings are in contradiction with the ones reported by Gherghina & Simionescu (2023).
Despite the various approaches used in the literature, some gaps can be observed from the analysis of the presented research.Specifically, most approaches used a smaller number of on-chain metrics (Jang & Lee, 2018;Saad & Mohaisen, 2018), with only recent works increasing the number of analyzed metrics to over 20 (Jay et al., 2020;Jagannath et al., 2021).Additionally, while on-chain metrics have been used in tandem with other data, only one study (Jay et al., 2020), introduced data from Twitter and it was volume data, not sentiment data, which has proven to improve prediction accuracy.However, the present study aims to address these gaps by introducing more on-chain metrics to improve prediction quality and increase understanding of Bitcoin price evolution, using Twitter sentiment alongside volume, and using a superior sentiment extraction technique compared to previous studies.Furthermore, larger time windows will be devised for price prediction, ranging from one to seven days, unlike the more limited time window used in previous studies.This measure was introduced to tackle the time sensitivity reported in research.Many articles find significant relationships in the short term but don't explore why these relationships might fade over longer periods or if a model could be devised that can handle long term predictions.The work presented in this article aims to predict on a larger time horizon, where the task becomes more challenging.

MATERIALS AND METHODS
To answer the research questions, we conduct a quantitative study.To this end, on-chain metrics, together with Twitter sentiment, are being used to determine the best approach for Bitcoin price prediction.This section will thoroughly present the concepts used in the current research and how they will blend to significantly improve the results.

On-chain analysis
The present study employs on-chain metrics to enhance the accuracy of a deep learning model for predicting cryptocurrency prices.To our knowledge, this study employs the largest number of on-chain metrics, namely 54, compared to previous studies.All on-chain data were collected from the public Bitcoin blockchain, utilizing application programming interfaces from online resources such as Glassnode (2022).To provide a comprehensive understanding of on-chain data and its potential for predicting cryptocurrency prices, a subset of 14 out of the 54 selected metrics is described in Table 1 along with their corresponding online resource descriptions.

Sentiment analysis
A machine learning approach is used to determine the sentiment of extracted tweets that builds upon previous research methodologies.Some researchers (Jagannath et al., 2021) dismissed sentiment analysis and used tweet volume for sentiment substitute, while others (Oprea et al., 2021) used basic sentiment analysis techniques.For this research, logistic regression (LR) is the preferred model for sentiment analysis, which predicts binary data such as positive or negative sentiment.LR is a simpler and less time-consuming technique, still widely used for sentiment analysis tasks (Tyagi & Sharma, 2018).
The Sentiment140 dataset, a balanced dataset of 1.6 million tweets, is used to train the LR model.The tweets are preprocessed by lowercasing the text, eliminating special characters, numbers, emojis, stemming, and lemmatizing the words.The dataset is split The LR model achieved an 83% AUC score, signifying a strong performance for a complex task.Additionally, the model demonstrated balanced results, implying a robust F1 score.For a more comprehensive evaluation, we compared the LR model's performance with that of VADER, a sentiment analysis tool often cited in prior research.The results for VADER are detailed in Fig. 2.
Upon comparison, VADER's performance fell short, with an AUC score of only 67-16% lower than the LR model.VADER appeared to particularly struggle with the over-identification of positive sentiments, known as False Positives.Based on these findings, we have determined that the LR model outperforms VADER and will be our chosen method for extracting sentiment from Bitcoin-related tweets.

Long-short term memory model
A long-short term memory (LSTM) network, which is a type of recurrent neural network (RNN), has been chosen for developing a predictive model.LSTM models are commonly used for time series prediction tasks and can capture long-term dependencies in data for accurate predictions.Previous studies have applied LSTM networks to predict asset prices  (Moghar & Hamiche, 2020), cryptocurrencies (Jagannath et al., 2021;Jay et al., 2020;Lahmiri & Bekiros, 2019), and the number of COVID-19 cases (Chimmula & Zhang, 2020).
LSTM networks consist of a memory cell and three gates (input, output, forget) that channel information through the layers.These gates use a sigmoid activation function to process the information and ensure that only positive values are passed to subsequent gates.The forget gate decides what information will be erased from the cell's state, while the input gate creates a candidate potential vector using an activation layer.The old state of the cell is updated, and the resulting hidden state is multiplied with the filtered output to obtain the hidden state for the next cell.The LSTM model operates on different time steps within each block and passes outputs to the next block until the final LSTM block generates the sequential output.
The LSTM network assumes a mini-batch size of n, the number of inputs as d, and h hidden units.Gates are defined as I t ∈ Rn×h (input gate), F t ∈ Rn×h (forget gate), and O t ∈ Rn×h (output gate) and are calculated using Eqs.( 1)-( 3).
Thus, the input is X t ∈ Rn×d and the hidden state of the last step is H t−1 ∈ Rn×h.Accordingly, the gates are defined as follows: the input gate is I t ∈ Rn×h, the forget gate is F t ∈ Rn×h, and the output gate is O t ∈ Rn×h.They are calculated as follows:  4), and the old state of the cell is updated using Eq. ( 5).
where W xc ∈ Rd×h and W hc ∈ Rh×h are the weight parameters and b c ∈ Ri×h is the bias parameter.Then, the old state of cell C t−1 is updated as follows: Finally, the hidden state h t is obtained by multiplying the state of the scaled cell by the filtered output, as shown in Eq. ( 6).

Proposed approach
The proposed approach involves several steps, including the collection of Twitter data and extraction of sentiment, the collection and pre-processing of on-chain data, and analysis of the relationship between the data and Bitcoin price using Pearson correlation and time series plots.The LSTM model is trained with different time steps, moving average windows, and hyperparameters, and evaluated using root mean squared error (RMSE), mean absolute error (MAE), and mean absolute percentage error (MAPE) metrics.The Martingale model serves as a baseline for comparison and is trained only on price data.The equations for RMSE, MAE and MAPE are depicted below: where n is the number of observations and y k and ŷk are the real and predicted values of kth point.The proposed flow is shown in Fig. 3.For a better representation of the PA and for better replication purposes, the steps of the PA are presented below.
d. Data cleaning (treat NA Values, for text data remove stop words, stemming, lemming).
f. Time series decomposition (ensure stationarity with Augmented Dickey-Fullerdifferencing is applied).
g. Sentiment analysis (train a logistic regression model on a public data set available on Kaggle-Sentiment140 in this example-and extract sentiment from Twitter Data).

Exploratory data analysis.
h. Univariate analysis (descriptive statistics for each metric).
i. Multivariate analysis (explore the relationship between metrics-Compute Pearson Correlation for all the selected variables).q.Performance evaluation (run the model on the test set and benchmark the results to identify the best performance).
The codebase used for this study can be found in the following Zenodo repository, which follows the logical flow presented above: https://doi.org/10.5281/zenodo.7791503.

Data
As previously stated, we used multiple datasets in this investigation.We constructed the Twitter dataset using the snscrape Python package, which serves as a scraper for social networking services.We collected the tweets from July 1, 2021, until June 30, 2022.There are 1,000 tweets collected per day, for a total of 365,000.Two restrictions are imposed on the scraper, i.e., the tweets had to be in English and they must not have been retweets.By excluding retweets, the aim is to maintain the independence of data points in the generated sample.Retweets often serve as duplicates of original messages and including them could introduce bias or artificially inflate the significance of sentiments or phrases in the analysis.The first entries of the resulting database are presented in Table 2.
Twitter data are enriched with the volume of tweets per day on the topic of Bitcoin, extracted from BitInfoCharts (bitinfocharts.com).After the Twitter data has been collected, the sentiment is extracted from the tweets.There are multiple pre-processing steps applied to the text.The selected model is LR, which outperformed VADER for this specific use case.The resulting data set is numeric, with binary data for sentiment (1 for positive or 0 for negative) and continuous data for volume.After the Twitter data is computed, the on-chain data are extracted and the working data set is created, joining the Twitter data and the on-chain data.On the working data, there are several preprocessing steps to ensure that the time series data is appropriate for analysis.First, all the data sets are normalized by applying z-normalization as in Eq. ( 7).
where x is the original value, l is the mean and r is the standard deviation.The study focused on the shift from a bull market to a bear market during the period from July 1, 2021, to June 30, 2022.The complete set of data used for this study can be found in the following Zenodo repository: https://doi.org/10.5281/zenodo.7791503.The bull market period covered the first 131 days from July 1, 2021, to the all-time high (ATH) date, while the bear market period covered the last 234 days starting from the ATH date of November 8, 2021.An inversion period of 30 days before and after the ATH was selected to better understand the signal for the bull-to-bear transition.The selection of this period was deliberate, aimed at studying the distinct mechanisms that drove both bull and bear market phases, as well as the factors contributing to the transition between them.Understanding these shifts is critical for investors, policy-makers, and researchers alike as it helps to navigate the volatile cryptocurrency market more effectively.The aim of this article is to develop a robust predictive model capable of navigating these market shifts, thereby providing a more comprehensive understanding of Bitcoin's price volatility across different market conditions.
The correlation matrix is used to identify on-chain metrics that have the most influence on Bitcoin price, answering RQ1 (the first part), and to analyze the three scenarios, answering RQ2.Only metrics with a Pearson correlation coefficient greater than 0.8 are presented in the correlation matrix for each scenario.This cutoff was selected based on common guidelines in statistical literature, which generally regard a correlation above 0.8 as very strong.This high threshold was used to ensure that only the most highly correlated variables were included in the initial model, to reduce multicollinearity and improve model performance.The bull market matrix is shown in Fig. 4. A high positive correlation exists between different metrics, some expected as they are derived from the price or each other, while others are block or mining metrics.These metrics indicate increased network interest and could be strong bull market indicators.Wallets with more than 0.1 Bitcoin show a high correlation with other metrics, suggesting an increasing number of new investors.Bitcoin Fund Holdings is the only metric presenting a negative correlation with all other metrics and could anticipate a drop as the market rushes toward the ATH, which could indicate an impending drop or a successful gamble.
In the bear market correlation matrix presented in Fig. 5, there is a tonal shift with many negative correlations observed.Bitcoin Fund Holdings, Hash Rate, and Supply Last Active 5+ years ago are absent, possibly indicating a cool-off in Fund activity and volatile market state with investors reacting by freezing their holdings or buying more Bitcoin.The negative correlation between small holding wallets and price suggests that new or inexperienced investors are trying to enter the market at a discount.UTXO points towards high market volatility with more transactions executed and sell orders put out.As such, RQ2 is answered as it can be noticed that on-chain metrics and Twitter sentiment exert different influences in different market conditions.This finding is aligned with previous research.
The inversion period correlation matrix in Fig. 6 reveals interesting findings, with a decrease in correlation between MVRV and NUPL and Market Cap and Price.MVRV is almost perfectly correlated with the two metrics in both bull and bear markets, but the inversion period shows a decrease in correlation.The absence of all the other metrics could be another sign of shifting behavior.Future studies could investigate present actions during a bear-to-bull market shift to determine if they align with this study's findings.
To identify what metrics could signal a 5% price variance of Bitcoin and answer the second part of RQ1, the correlation matrix is computed.Only days that precede price changes of more than 5% are selected.The same filters as before are applied, and only metrics that present a correlation coefficient greater than 0.8 are selected.The resulting matrix, presented in Fig. 7, closely resembles the correlation matrix of the inversion period.This similarity points toward a sign of inversion when the price swings greater than 5%, it becomes more frequent.As in the case of market inversion, the same metrics are present: Market Cap to Thermocap Ratio, MVRV, NUPL and Market Cap.High volatility of these metrics' points toward high volatility of the price the following day.
Next, to better understand how price relates to various other metrics over time, particularly Twitter data, we will present the Pearson correlation coefficients for each metric at different time lags.This analysis aims to address Research Question 3 (RQ3).The relevant data for this can be found in Table 3. First, it can be noted that Twitter data have little influence on the present price of Bitcoin.However, as the price is lagged further into the future, Twitter data becomes more significant.The correlation between the volume of tweets and price increases the greater the time difference between the two.From lag 7 onwards, the coefficient becomes statistically significant, and the value reaches a maximum of 0.49.The two metrics are negatively correlated.This could indicate how long it takes for the price to assimilate discussions and activity on Twitter.For Twitter sentiment, there seems to be no correlation present, for any lag of price, answering RQ3.This finding is consistent with previous research, and Twitter could not be a reliable source of Bitcoin From Fig. 8, it can be seen the previously identified high correlation with price, exhibiting higher volatility.However, in more recent months, when Bitcoin price has fallen considerably, NUPL seems to exhibit higher volatility.This could point to a smaller NUPL volatility and higher price volatility in bull markets and a reverse in bear markets, where NUPL volatility increases, and the price tends to stabilize.Although lower, the Spent Output Profit Ratio (SOPR) seems to exhibit some level of correlation with the price.It must be mentioned that both NUPL and SOPR show positive correlation coefficients, which point to a direct relationship between them and the price.Again, to better understand the relationship between SOPR and Bitcoin price, the time series are plotted in Fig. 9.   Unlike NUPL, SOPR seems to exhibit higher volatility in a bull market and tends to stabilize in a bear market.The correlation between SOPR and price is noticeable, but it is obvious that it isn't a strong one, as seen in the case of NUPL.However, further study of the relationship between SOPR and price could unlock a greater understanding of how the two are connected and how SOPR could be leveraged to predict the price evolution of Bitcoin.Lastly, while negligent, the relationship between Twitter Sentiment and Bitcoin price will be studied.The two normalized time series are plotted in Fig. 10.
As stated above, no apparent relationship exists between the two.However, what is interesting is that Twitter sentiment seems to spike right before a price drop.This could point to many things, from overly optimistic holders that hope their investment will net a good return to mischievous players who seek to manipulate the sentiment and determine others to buy in so they can then dump their coins.It could also point to a mixture of the two scenarios or even other cases.Future studies could look deeper into the connection between social media and cryptocurrencies, by implementing more advanced NLP techniques.
The input data selection step follows this analysis phase.Different thresholds are set for the experiments, adding more data as the experiments are running.

Experimental setup
The experiments are run on an Intel I7 3,930 k CPU and an Nvidia GTX 1070 8 GB GPU machine.The Python version used was 3.9.12 and Tensorflow version 2.6.0.The proposed algorithm for the best variable combination identification is presented in Fig. 11.
The algorithm works as follows.To select data, 12 thresholds are set from more to less restrictive.Six time-steps are used for each method, ranging from 1 to 14 days.The moving average windows range from 1 to 30.A total of 135 unique hyperparameter combinations are used to train the LSTM models.In total, 291,600 models are trained and benchmarked using the Adam optimizer and mean squared error (MSE) loss function over 100 epochs.The proposed method aims to identify the best combination of metrics, including the correlation threshold, data transformation using the moving average sample, and deep learning parameters such as layer size, dropout, and learning rate.These combinations generate the best results, the lowest predictive error, for each selected time step.Table 4 presents all experimental parameters, including the 291,600 unique combinations resulting from these parameters.Coefficients for correlation threshold and dropout are shown, while the time step represents the number of days predicted, the moving average window

RESULTS
The results of the trained models for predicting Bitcoin price are presented in Table 5, comparing the performance of the Proposed Approach (PA) and the Martingale (Mart) Approach Benchmark.The results reveal that the PA outperforms the Martingale approach in 3 out of the 6-time steps, with an average improvement of 9.3% in Mean Absolute Percentage Error (MAPE).Table 6 shows the selected metrics for each threshold, which demonstrates the best combination of variables for each time step.For the 1-day time step, the best-performing model includes Price, Market Cap, MVRV, NUPL, and Market Cap to Thermocap Ratio variables.The best-performing models for the 5-and 7-days time-steps require more restrictive thresholds, retaining only highly correlated variables as inputs.As the time step increases, the threshold for improvement decreases, with a maximum of 40%.Figures 12-14 further illustrate the performance of the best-performing models in predicting Bitcoin price evolution.
When comparing the results of the PA with Chen (2023), the PA achieves superior results in both root mean squared error (RMSE) and MAPE, as shown in Table 7.The improvement in performance is attributed to the enhanced data collection, data analysis and processing, and model selection and hyperparameter tuning steps.

DISCUSSION
Comparison with the martingale approach In the field of financial market research, the Martingale model serves as a foundational benchmark for assessing market efficiency and predictability (Smith, 2009;Richard & Vecer, 2021).The Martingale model postulates that future price movements are entirely independent of past prices, implying that no investment strategy can yield returns exceeding those achieved by random chance.In this study, the Martingale model is used as a baseline for comparison to evaluate the effectiveness of the PA, which utilizes on-chain metrics and Twitter sentiment data.If the proposed models outperform the Martingale model, it suggests that the analyzed variables contain predictive information about Bitcoin's price movements, thus offering the potential for traders to achieve better returns.By contrasting the findings against this well-established benchmark, the aim is to provide a rigorous assessment of the unique predictive capabilities introduced by the selected variables.
The proposed approach outperforms the Martingale method in predicting Bitcoin prices, yielding a lower average MAPE score for the 6-time steps.The most significant improvement is observed in longer time steps, such as a 60% enhancement for the 14-day time step.The Martingale model performs well for predicting the next day and three-day prices, but its performance deteriorates as the lag between the present price and the predicted price increases.On average, the proposed approach shows a 9.3% improvement in MAPE compared to the Martingale method.Therefore, RQ4 is answered.By implementing a combination of on-chain metrics and Twitter sentiment, an increase of 9.3% in prediction performance is achieved.

Thresholds and model performance
For the 5-and 7-day models, the best performance is achieved when the threshold is more restrictive, retaining only the highly correlated variables in the input.As the prediction horizon increases and the predictive quality of the present price decreases, using a broader range of metrics improves the model's performance.Consequently, less restrictive thresholds can lead to improved results when working with longer time steps.
For the 1-day time step, the best performance is obtained when the model is trained with Price, Market Cap, MVRV, NUPL, and Market Cap to Thermocap Ratio variables.While the present-day Price offers sufficient information for high-quality predictions, other metrics enhance performance albeit not substantially.For the 10-day time step, additional metrics are incorporated into the predictive model, including Over 0.01, Over 0.1, Over 1, Inter-Exchange Transfers, and Supply Last Active 1+ Years Ago.The inclusion of Supply Last Active 1+ Years Ago, an important metric for the Bitcoin bear market, improves predictive performance.As the time step increases, the threshold for improvement decreases, with a maximum of 40%.

Long-term predictions
The proposed approach yields reliable results for long-term predictions, such as 10 or 14 days ahead, albeit less accurate.These outcomes encourage further research, showcasing the potential performance when on-chain metrics are input into a deep learning model.

Comparison with Chen (2023)
The best comparison is achieved when benchmarking with Chen (2023)-Period 2, due to the varying time frames used in the analysis of the two papers.When comparing the two approaches, the PA achieves superior results in both RMSE and MAPE, with improved performance in a smaller data sample by a factor of 4. The performance improvement can be attributed to several factors: enhanced data collection, better data analysis and processing using a more advanced sentiment extraction technique (logistic regression vs VADER), and the model selection and hyperparameter tuning process that ensured optimal parameter selection.This last factor is particularly important, as the performance of LSTM models is often highly sensitive to hyperparameter choices, making the tuning process both challenging and time-consuming.By presenting a better Bitcoin price prediction method, the practical implications of this study are that investors and other stakeholders can make more informed decisions.

Comparison with literature
When comparing to the related literature, this work adds a new layer by introducing a wide range of on-chain metrics alongside Twitter sentiment, providing a more holistic model.Furthermore, prior works focused largely on investor sentiment and attention as isolated factors (Guegan & Renault, 2021;Li et al., 2022).This study synthesizes these with onchain metrics, creating a more comprehensive analysis framework.In reference to time scale, previous articles largely indicated that their models or factors were mainly significant in the short term (Bouteska, Mefteh-Wali & Dang, 2022).The present research offers insights into more long-term behavior, especially during the transition from bull to bear markets.
As such, the novelty of this study lies in its multi-dimensional approach to predicting Bitcoin prices.While previous research has separately examined on-chain metrics or investor sentiment, ours is the first to combine these in a complementary manner.Compared to work of Jay et al. (2020), our study expands the data extracted from Twitter, by introducing the sentiment component.As such, this is the first study, to our knowledge, to combine on-chain metrics with social media sentiment and it further bridges the gap between social media sentiment and the crypto market.We believe this is an evolution in the field, as it culminates the work done up to this point and lays new paths going further.This enables a more comprehensive understanding and prediction model that captures both technical and psychological market factors, filling a gap in existing literature.Therefore, future works can build upon the research presented in this article and further analyze the interconnectivity between social media data and blockchain data, to further improve the performance of prediction models.For industry stakeholders, the work presented in this article could facilitate the implementation of the PA to yield improved returns and to gain a better understanding of the forces that drive the cryptocurrency market.Therefore, if financial gain is to be had from the PA, additional ethical concerns should be accounted for.

Novelty and impact on field of study
This research presents a new methodology for forecasting Bitcoin prices by combining onchain metrics with Twitter sentiment data, resulting in a distinctive combination of transactional and public sentiment indicators.Our research enhances the predictive accuracy and captures the dynamic nature of cryptocurrency markets by contrasting with traditional models such as the Martingale.The results have important implications for both scholarly discussions and real-world implementations, offering investors, stakeholders, and researchers a comprehensive instrument that encompasses the diverse factors influencing cryptocurrency prices in the digital era.
As such, our research distinguishes itself within the field of cryptocurrency studies by presenting a unique approach that combines on-chain metrics and Twitter sentiment data to forecast the price of Bitcoin.In the past, scholarly investigations in this field have frequently focused on analyzing these data sources individually.In the context of blockchain analysis, on-chain metrics provide valuable information regarding transaction volumes, active addresses, and other activities specific to the blockchain.However, it is important to acknowledge that these metrics may overlook the emotional and psychological aspects that can exert an impact on price dynamics.In a synergistic manner, the analysis of sentiment in Twitter data offers valuable insights into the overall mood and perceptions of the wider community.However, it is important to note that this analysis lacks the empirical support provided by tangible transactional data.By integrating these two components, our model effectively encompasses both the quantitative factors influencing Bitcoin's fluctuations and the qualitative sentiments that underlie its perceived worth.

Limitations and future work
A potential weakness of the study lies in its reliance on deep learning models, which tend to shift data and predict future prices as the present value.While the PA addresses this issue and generates improved results, predicting the price for large time gaps remains highly challenging.This limitation necessitates further research to optimize the performance of deep learning models when they utilize on-chain metrics, and to explore alternative modeling techniques that might complement the current approach.Some possible directions for future work include: 1. Investigating the use of ensemble methods, which combine the predictions of multiple deep learning models, to improve the overall prediction accuracy and robustness.This strategy could potentially mitigate the shortcomings of relying on a single deep learning model for predicting prices over large time gaps.
2. Exploring the use of other statistical and machine learning techniques, such as support vector machines, decision trees, Bayesian models, or Hidden Markov Models to complement deep learning models.These alternative methods might provide different perspectives on the data, and help identifying different market regimes or trends, such as bullish, bearish, or sideways movements.
3. Incorporating additional external factors, such as macroeconomic indicators or news sentiment, to better capture the complex dynamics of the cryptocurrency market.This could help improve the predictive power of the model, especially for longer time horizons.
4. Expanding the selected time interval, which currently serves as a snapshot of Bitcoin's history.The selection process for on-chain metrics could also be broadened.Insufficient data can result in overfitting or poor generalization.
5. Experimenting with different architectures or configurations of deep learning models, such as attention mechanisms, to better capture the temporal relationships between onchain metrics and future price movements.This could potentially address the issue of models predicting future prices as the present value.
6. Conducting comprehensive evaluations of the model's performance across different market conditions, such as bull and bear markets, could offer insights into the robustness of the proposed approach and identify areas for improvement.
Besides these broader limitations, there are some specific to this study.One such limitation is the use of a single platform, Twitter, for sentiment analysis.As a result, the sentiments captured may not fully represent the broader investor sentiment that could be gathered from multiple social media platforms.Another limitation is the choice of onchain metrics, which, while expansive, is not exhaustive and may overlook other potential indicators of Bitcoin price.Another limitation is the sole use of the Pearson correlation to analyze the relationship between data and to establish the information cutoff.The results might be sensitive to the threshold cutoffs that were put in place.Additionally, the Pearson correlation measures only linear relationships and does not capture non-linear dependencies that could exist between the variables.To address this, future studies could incorporate additional measures of dependence, such as the Spearman rank correlation for monotonic relationships and potentially mutual information for more general dependencies.This will provide a more comprehensive view of the relationships between the variables.
By tackling the identified shortcomings and exploring the proposed directions for future studies, we could enhance the predictive capabilities of deep learning models in forecasting cryptocurrency prices over longer time spans.
The managerial implications that derive from this work enable different stakeholders, such as investors or legislators, to extract more and better information from existing data and make better decisions.Stakeholders involved in the decision-making process should follow the work presented in this article, the findings, and the proposed methodology to better understand the factors that influence the evolution of Bitcoin and respond accordingly.
Our study has some drawbacks, such as a restricted timeframe, utilization of a sentiment extraction method that enhances prior implementations but might not represent the most advanced approach for sentiment analysis, and incomplete on-chain metric selection.Future research can expand the time interval, enhance sentiment extraction using advanced NLP models, integrate more metrics, and improve forecasting models for better Bitcoin price predictions.
In closing, the contribution of this research should be reiterated.This is the first study to incorporate many on-chain metrics for Bitcoin and Twitter sentiment extracted with a superior method compared to previous implementations.These improvements have shown to yield great results and have proven that highly accurate Bitcoin price prediction is achievable.Furthermore, new insights have been extracted regarding the behaviour of the Bitcoin market, especially during the transition period from a bull to a bear market.These findings enable a better understanding of the market and an improved ability to predict its behaviour.
Simona Vasilica Oprea analyzed the data, authored or reviewed drafts of the article, and approved the final draft.

Figure 1 Figure 2
Figure 1 Confusion matrix and area under curve (AUC) for the LR model.Full-size  DOI: 10.7717/peerj-cs.1750/fig-1 3) where W xi ,W xf ,W xo ∈ Rd×h and W hi ,W hf ,W ho ∈ Rh×h are the weight parameters and b i , b f , b o ∈ Ri×h are bias parameters.The candidate potential vector C t is computed using Eq. (

Table 1
On-chain data metrics overview.
into training and testing sets with an 85/15 split.Figure1highlights the performance of the LR model.

Table 2
Twitter sentiment data example.

Table 3
Pearson correlation coefficient with price (statistical significance, p-value).

Table 7
The proposed approach (PA) vs Chen (2023) approach benchmark.(BOLD representes the best result for each metric-RMSE and MAPE.)