Volume 2025, Issue 1 4211799
Research Article
Open Access

Cryptocurrency Trend Prediction Through Hybrid Deep Transfer Learning

Kia Jahanbin

Kia Jahanbin

Department of Computer Engineering , Yazd University , Yazd , Iran , yazd.ac.ir

Search for more papers by this author
Mohammad Ali Zare Chahooki

Corresponding Author

Mohammad Ali Zare Chahooki

Department of Computer Engineering , Yazd University , Yazd , Iran , yazd.ac.ir

Search for more papers by this author
First published: 14 February 2025
Citations: 1
Academic Editor: Gianni Costa

Abstract

The impact of sentiment analysis of comments on social networks such as X (Twitter) on the cryptocurrency market’s behavior has been proven. Also, traditional sentiment analysis and not considering the possible aspects of tweets can cause the deep model to be misleading in predicting the price trend of cryptocurrencies. In this research, a model using transfer learning and the combination of pretrained DistilBERT networks, BiGRU deep neural network, and attention layer is presented to analyze the sentiments based on the aspect of tweets and predict the price trend of eight cryptocurrencies. These tweets are the opinions of 70 cryptocurrency expert influencers. After preprocessing, these tweets are injected into the hybrid model of DistilBERT, BiGRU, and attention layer (HDBA) to extract the aspect and determine the polarity of each aspect. The output of the HDBA model is entered into the combined model of BiGRU and the attention layer (HBA) to predict the price trend of each cryptocurrency in intervals of 1–10 days. The output of the HBA model is the best time interval of the influence of the sentiments of tweets on the price trend of cryptocurrencies. The results show that the HDBA model has improved the performance of the aspect-based sentiment analysis task by an average of 3% in the benchmark datasets. The results of the HBA model also show that this model has been able to predict the best time frame of the impact of sentiments on the behavior of the cryptocurrency market with an average accuracy of 68% and a precision of 73%.

1. Introduction

With the emergence of cryptocurrencies as a fast, safe, and intermediary method for transactions and investments, many investors have accepted it as a digital asset over time. Investing and doing transactions with cryptocurrencies, and at the top of them, Bitcoin gradually took a larger market cap share. For example, in 2017, the market value of Bitcoin as the first decentralized cryptocurrency increased from 17.71 billion dollars to 631 billion dollars; in the same year, the final price of Bitcoin also increased from 993 dollars to 19,168 dollars [1]. This significant growth was an opportunity to increase investment returns in cryptocurrencies, and most assets could not provide such returns [2].

However, like other financial assets, cryptocurrencies are not exempt from fluctuations. Still, their price fluctuations are more intense due to their decentralized nature and the influence of many political and social factors. One of the factors affecting cryptocurrencies is the opinions of famous and influential people. In other words, cryptocurrencies are influenced by the opinions of prominent people who are called influencers in social networks [3]. One of the popular platforms where influencers publish their opinions is Twitter.

X holds significant importance as a dynamic and influential social media platform. Its real-time nature enables the rapid spread of information, making it a vital source for breaking news, trends, and updates. Twitter serves as a platform for public discourse, networking, customer service, and crisis communication, impacting fields ranging from economics to politics. Its ability to democratize communication and foster connections makes it a crucial tool influencing how information is shared, opinions are formed, and communities are built in the digital age [4].

According to Erdin et al. [5], influencers’ social media comments significantly affect cryptocurrency. Figure 1 shows Elon Musk’s tweets’ effect on the quantitative trend of Bitcoin and Dogecoin in different periods.

Details are in the caption following the image
The effects of Elon Musk’s tweets on the price of Bitcoin.

One of Elon Musk’s most famous tweets, shown in Figure 2, is the tweet known as breakup. Published on June 4, 2021, it led to a 5% drop in the price of Bitcoin.

Details are in the caption following the image
Elon Musk’s famous tweet as a breakup for Bitcoin.

Also, in Table 1, the set of representative tweets of Elon Mask, as shown in Figure 1, is shown along with the price effects on Bitcoin [5].

Table 1. The impact of tweets on sentiments and market trends [5].
Date Tweet Sentiment
29-01-2021 Changed Twitter Bio to #bitcoin Positive
24-03-2021 You can now buy a Tesla with Bitcoin Positive
13-05-2021 Tesla is no longer accepting Bitcoin Negative
16-05-2021 Suggests Tesla is selling Bitcoin Negative
17-05-2021 Tesla has not sold any Bitcoin Positive
04-06-2021 #Bitcoin breakup Negative

For another example, after Elon Musk’s appearance on Saturday Night Live in May 2021, the price of Dogecoin dropped 34%. Therefore, as shown in Table 2 and Figures 1 and 2, the statements of influencers significantly affect the price of cryptocurrencies.

Table 2. List of abbreviations.
Abbreviations Main word
CNNs Convolutional neural networks
LSTM Long short-term memory
ABSA Aspect-based sentiment analysis
BiGRU Bidirectional gated recurrent unit
MLP Multilayer perceptron
HDBA Hybrid deep transfer learning with DistilBERT + BiGRU and attention layer
HBA Hybrid BiGRU and attention layer
IC Importance coefficient
NN Neural network
SVM Support vector machine
RF Random forest
MAE Mean absolute error
RMSE Root mean squared error
OHLCV Open, high, low, close, volume
ACC Accuracy
TP True positive
FP False positive
TN True negative
FN False negative
LR Learning rate
BU BiGRU units
DR Dropout rate

Therefore, knowing and predicting market behavior and sentiments can reduce the risk of cryptocurrency trading and investment. A review of previous studies shows that the validity of the source of opinions is effective in the prediction and decision-making process in stock selection [5]. As a result, the importance of choosing reliable sources in the cryptocurrency market is considered a research gap. In past studies, most tweets have been extracted based on hashtags with the names of cryptocurrencies [3, 6]. This issue causes many opinions of people who do not specialize in cryptocurrencies to affect the decision making of the models. To avoid adding nonexperts’ opinions in this research, the tweets of 70 cryptocurrency influencers were extracted between January 01, 2023, and June 12, 2023 [7].

Another challenge in price prediction based on Twitter information is sentiment analysis of cryptocurrency tweets. Deep learning models need a large amount of labeled data for training, which is rare in cryptocurrencies [8]. One of the methods used to solve the problem of lack of labeled data is data argumentation using cross-domain data. However, cross-domain data must have a high similarity with the destination domain; otherwise, it can lead to a decrease in model efficiency or a negative transfer phenomenon [9].

Therefore, in this research, the datasets with the most cosine similarity with the cryptocurrency dataset have been used to train the pretrained DistilBERT neural network as the network’s backbone. Using pretrained models instead of essential deep neural networks such as convolutional neural networks (CNNs) or long short-term memory (LSTM) has the advantage that these models are trained on voluminous data and only need to be adapted to the desired task [10]. Using the trained model in a different task and adapting it for use in another task is called deep transfer learning. In other words, in transfer learning, we use the knowledge learned in a different but similar context (the so-called source domain) to perform tasks in another context (the so-called target domain) [11].

A few studies show the effect of choosing a cross-domain dataset with the cosine similarity criterion in the source domain, which is mentioned below. These studies show that selecting data with favorable similarity can reduce negative transfer in deep transfer learning.
  • 1.

    “Deep Transfer Learning for Cross-domain Activity Recognition” discusses how selecting the most similar source domain based on cosine similarity can prevent negative transfer. The source domains with higher cosine similarity scores to the target domain are chosen to ensure effective knowledge transfer and minimize the risk of negative transfer. This approach ensures that the transferred knowledge is relevant to the target domain, thereby improving model performance and reducing errors associated with dissimilar data [12, 13].

  • 2.

    “Maximizing Cosine Similarity Between Spatial Features for Unsupervised Domain Adaptation” also emphasizes maximizing cosine similarity between source and target domain features. By ensuring a high cosine similarity at the feature level, this method aligns source and target domain representations more closely, reducing the domain gap and mitigating negative transfer during semantic segmentation tasks [14].

  • 3.

    “Cross-Domain Similarity in Domain Adaptation for Human Activity Recognition” shows how using cross-domain similarity metrics, such as cosine similarity, can improve model classification accuracy and help reduce negative transfer. By aligning the domains with similar feature distributions, cosine similarity is crucial to ensure effective transfer learning without causing performance degradation [13].

To adapt the DistilBERT pretrained network to the Twitter sentiment analysis task, the SemEval-Task 2014 dataset has been used as the cross-domain dataset. This dataset is very similar to the cryptocurrency tweet dataset. Another reason for using SemEval is the classification of emotions in the form of aspect base. Aspect-based sentiment analysis (ABSA) datasets are scarce, even for public tweets, and in the case of cryptocurrencies, high-quality datasets are rare.

Another challenge of this research is the sentiment analysis of aspect-based tweets to predict the price trend of cryptocurrencies. In previous studies, not much attention has been paid to analyzing aspect-based sentiments of cryptocurrencies, and methods such as VADER have been used. VADER cannot recognize aspects of the text and considers the whole text as a single set. In addition, VADER is a lexicon-based method designed for general texts [12, 15].

Another challenge is determining the appropriate time frame for predicting the price trend of each cryptocurrency. In previous research, trend or price prediction is usually done in one or several days at fixed intervals [13, 14]. However, the results show that the impact of sentiments and historical price on the price trends of different cryptocurrencies is different. For instance, when evaluating influencer’s sentiments, the suggested model shows the highest accuracy in predicting Bitcoin’s price on the second day. Conversely, it is more effective in forecasting Ethereum’s price trend on the third day. Therefore, in this research, the period is considered a hyperparameter.

Another challenge this research considers is assigning an importance coefficient (IC) to each tweet. Previous studies assigned the IC to the user [16, 17]. Assigning this coefficient to the user causes the most important tweets of the user with fewer followers to be ignored. This research assigns importance to each tweet based on the number of likes, retweets, and replies. This coefficient shows the tweet’s importance from other users’ point of view.

Therefore, the main goal of this article is to predict the price trends of seven cryptocurrencies, Bitcoin, Ethereum, Binance, Shiba, Solana, Ripple, and Polygon, using sentiment analysis based on the aspect of 70 Twitter influencers with transfer deep learning. In general, in this research, tweets are first extracted, and after preprocessing and assigning the IC to each tweet, they are injected into the transfer deep learning model for aspect-oriented sentiment analysis. This learning model combines DistilBERT, bidirectional gated recurrent unit (BiGRU), and attention layer (hybrid deep transfer learning with DistilBERT + BiGRU and attention layer—HDBA). The sentiments extracted for each cryptocurrency are separated and injected with the historical price of the cryptocurrency into the BiGRU hybrid deep neural network and the attention layer (hybrid BiGRU and attention layer—HBA) to predict the price trend in 1–10 days. The HBA model calculates the prediction accuracy for each cryptocurrency in 1–10 days and reports the highest accuracy on the test data.

The significant contribution to this article is as follows:
  • 1.

    Using the sentiments of tweet influencers to predict the trend of cryptocurrencies, which causes public and unimportant or unrealistic tweets to be effectively removed.

  • 2.

    Using cross-domain data to train DistilBERT as a network backbone for sentiment analysis based on cryptocurrencies and fine-tuning the HDBA model using the grid search method to prevent overfitting of the model. Also, in this research, cosine similarity is used to select inter-domain datasets, which causes negative transfer to be reduced by selecting datasets more similar to the target domain for training.

  • 3.

    Allocating the IC to each tweet instead of the user to identify influential and essential tweets. This makes the tweets to be validated regardless of the number of followers of the user.

  • 4.

    In this research, sentiment and historical price impact on each cryptocurrency’s price trend has been investigated separately. The results show that the time frame of the effect of tweets and historical price on the price trend of cryptocurrencies is different. For example, if positive tweets about Bitcoin increase in the next three days, positive tweets about Ethereum will increase in another 4–6 days. Therefore, in this research, in addition to the fact that the period is considered a hyperparameter, the effect of this period on different cryptocurrencies is also a hyperparameter.

Therefore, in an overview, the research gaps and innovations of the article are mentioned below.
  • 1.

    Addressing the challenge of sentiment and price data integration: Mai et al. [18] highlighted the difficulty in integrating sentiment analysis and market data to forecast cryptocurrency prices. Traditional models often analyze these factors independently, leading to less accurate results. The proposed framework directly addresses this limitation by combining DistilBERT-based sentiment analysis and historical price data through BiGRU and attention mechanisms. This hybrid approach allows for a more comprehensive forecasting model considering market trends and public sentiment.

  • 2.

    Novelty in transfer learning for crypto markets: Transfer learning in cryptocurrencies has not been widely explored, as Roy et al. [9] highlighted the lack of labeled data for practical model training. DistilBERT fills this gap in the proposed framework, which applies transfer learning to fine-tune models of cryptocurrency-related sentiment. This method allows the use of pretrained linguistic models and makes predictions more robust in situations with limited labeled data.

  • 3.

    ABSA as a unique contribution: Alonso et al. [19] show that most cryptocurrency-related studies focus on aggregate sentiment analysis and miss the effects of ABSA granularity. The proposed framework fills this gap by incorporating ABSA, which identifies and analyzes specific factors in sentiment (e.g., regulations and technological developments) and their direct relationship to price changes. This level of analysis increases the model’s accuracy in predicting price movements under the influence of target subjects.

  • 4.

    Improved prediction accuracy through hybrid models: Previous studies, such as Valencia, Gómez-Espinosa, and Valdés-Aguirre [20], identified that single-model approaches struggle to capture temporal dependencies in price data and sentiment signals from social media. HDBA and HBA models address this issue by integrating deep learning techniques with attention mechanisms and providing a more accurate and comprehensive solution.

  • 5.

    Comparison with traditional models: In the study of Shen, Urquhart, and Wang [21], the limitations of base machine learning models, such as support vector machines (SVMs) and random forests, were highlighted in their predictive accuracy in volatile markets. Compared to these models, the proposed framework performs better in cryptocurrency price prediction, especially in high-speed markets such as Bitcoin and Ethereum.

  • 6.

    Real-time data integration for high-frequency trading: Chen, Li, and Sun [22] discussed that high-frequency trading models often fail to integrate real-time sentiment data, leading to delayed or inaccurate predictions. The proposed framework effectively addresses this gap by incorporating real-time social network sentiment analysis data and provides more accurate and timely forecasts.

Table 2 shows a list of abbreviations in the order of being mentioned in the paper.

This paper uses deep transfer learning and cross-domain data as critical methods to improve cryptocurrency price prediction. These approaches are designed to solve problems related to the lack of specific cryptocurrency data and more accurate market analysis. Deep transfer learning allows models to transfer knowledge acquired in a particular domain to a new one. Instead of training the model from scratch in a specific domain, models already trained in other domains can be used. This method requires fewer computing resources and increases the models’ learning speed without reducing accuracy [23].

This study also uses the DistilBERT model for natural language analysis. DistilBERT is an optimized and more compact version of the BERT (bidirectional encoder representations from transformers) model used to understand the meaning of words in texts. DistilBERT brings the knowledge gained in more general text analysis to the crypto domain, allowing us to accurately identify positive, negative, or neutral sentiments in tweets. In addition to increasing processing speed, this approach also improves the accuracy of sentiment analysis [24].

BiGRU is another model used in this research. This model processes sequential and temporal data, such as cryptocurrency price data. BiGRU allows the model to analyze data from past and future events simultaneously. For example, the model can examine how a particular tweet has affected the price of cryptocurrencies and predict how this tweet will affect future prices. The reason for using BiGRU is that this model can more accurately identify complex temporal relationships between data and, therefore, provide more accurate forecasts of price fluctuations [25].

Another critical concept in this research is the use of attention layer. The attention layer helps the model to focus on the more essential parts of the data. Simply put, this layer acts like a filter that tells the deep learning model which parts of the text or data should be more critical. For example, in the analysis of tweets, specific keywords or phrases may have a more significant impact on the price of cryptocurrencies. The attention layer helps the model identify and use these keywords to predict prices. This approach allows the model to more accurately understand the specific and more detailed effects of each tweet on future prices [26].

Another essential feature of this research is the use of different combinations of information. This information is collected from several other areas and includes tweets from influential people in the field of cryptocurrencies and price data. Using these data helps the model to use social and financial data simultaneously to improve forecasting accuracy. This method is especially effective in complex areas such as cryptocurrency trend forecasting, which requires a combined economic and social data analysis. By combining tweet data and historical prices, the model can predict price trends more accurately and adapt better to sudden changes in the market. Therefore, combining deep transfer learning, using DistilBERT, BiGRU, attention layer models, and cross-domain data has improved the accuracy of cryptocurrency trend predictions. These models allow us to identify market sentiment by analyzing tweets from influencers and predict cryptocurrency trend changes with greater accuracy. These methods have also had positive results in previous research in the financial and economic fields. In this research, they have significantly improved predictions related to market fluctuations [27].

In the second part, we will review related works. In the third part, brief explanations are given about transfer deep learning and deep neural networks DistilBERT, BiGRU, and attention layer, and then we explain the HDBA and HBA models. In the fourth part, the used databases, evaluation parameters, how to set HDBA and HBA models, and the results of experimental setups are studied. Finally, in the fifth section, we will conclude and suggest future work.

2. Related Works

Cryptocurrency is a digital asset whose most important use is to use it as a transparent, fast, and peer-to-peer financial system for transactions. Unlike common currencies, cryptocurrencies have no affiliation with government or international institutions. However, the news and comments of officials or government policies regarding their acceptance or nonacceptance as a legal asset affect their price trends. Therefore, due to the lack of regular financial rules and regulations regarding cryptocurrencies, these digital assets strongly depend on the investors’ acceptance of them [5].

Kiran and Stannett [28] wholly classified Bitcoin risks as the most prominent cryptocurrency. One of the risks is social risks. Society’s reaction to Bitcoin and its changes and people’s inclination toward technology will affect its price. For example, advertising among the general public will cause an explosive increase in uninformed users in investing in cryptocurrencies. This increase leads to price bubbles and market fluctuations.

Another risk is economic. In other words, the volatility of Bitcoin in recent years has been higher than that of the stock market. In addition, the Bitcoin market is driven by market participants. On the other hand, the expansion of social networks and their use as quick, easy, cheap, and accessible tools led to the emergence of influencer marketing. In influencer marketing, market activists and investors can have a more significant impact by using the power of social networks to induce their investment strategy to others [29] Therefore, extracting and understanding the sentiments in influencers’ opinions about any stock, especially cryptocurrencies, can help investors predict their future.

Kristoufek investigated the impact of the number of visits to Bitcoin-related pages on Wikipedia and Google Trends on the price of Bitcoin. In this research, using a correlation model and vector autoregression, it was shown that the increasing and decreasing trend of search is correlated with the increasing and decreasing trend of Bitcoin price [30]. Stenqvist and Lönnö investigated the effect of sentiment fluctuation on the price change of Bitcoin in small time frames (5 min–4 h). The evaluation of the model indicates that gathering tweet sentiments over a 30-min period, with four forward shifts and a sentiment change threshold of 2.2%, achieves an accuracy rate of 79% [31].

Mai et al., using the vector error correlation model and the Granger causality test, tried to investigate the effect of Bitcoin price on the emotions of social networks. The results showed that social media sentiment is an essential predictor in determining the value of Bitcoin, but not all messages published on social media have the same effect [18].

However, some tweets are intentionally or unintentionally misleading. Deliberately misleading tweets or fake news are produced to create a price bubble in cryptocurrencies and mainly follow specific patterns [19]. On the other hand, many unintentionally misleading messages are produced due to the user’s lack of expertise and sufficient knowledge and simply as an expression of personal opinion with the cryptocurrency hashtag. Therefore, if tweets are extracted based on hashtags, and without regard to the user’s expertise, as in most previous studies [3, 6], it can cause the model to be misleading in cryptocurrency prediction. In addition, as shown in Mai et al. [18], social network comments do not have the same effect. Therefore, in this research, the importance factor has been used to assign points to each tweet. The IC shows the popularity and influence of each tweet among other users.

Valencia, Gómez-Espinosa, and Valdés-Aguirre highlight the potential for gaining insights into market behavior through sentiment analysis and machine learning techniques. The authors propose a broader approach, employing common machine learning tools and social media data to predict price movements in Bitcoin, Ethereum, Ripple, and Litecoin markets. Their comparative analysis involves NNs, SVM, and RF, using input features from Twitter and market data. The findings reveal that machine learning and sentiment analysis can predict cryptocurrency markets, with Twitter data alone proving effective for specific cryptocurrencies, with NNs delivering the best performance among the models [20].

Shen, Urquhart, and Wang evaluated the relationship between the attractiveness of Bitcoin for investors (number of tweets) and Bitcoin return, transaction volume, and perceived volatility in Twitter in a research using linear and nonlinear Granger causality tests. The results showed that the number of tweets significantly fluctuates and predicts the volume of future Bitcoin transactions [21].

Chen, Li, and Sun showed that machine learning algorithms, including random forests, XGBoost, quadratic linear diagnostic analysis, SVM, and LSTM, perform better than statistical methods for predicting the price of Bitcoin in 5 min, and their accuracy reaches 67.2% [22]. Also, Kraaijeveld and Smedt showed by using a vocabulary-based approach and two-way Granger causality test, sentiment analysis of cryptocurrencies can help investors make the right decision [3].

Another approach that has received much attention in predicting the price trend of cryptos with sentiment analysis is using simple pretrained models such as VADER and deep ones such as BERT’s family in sentiment analysis. VADER is a rule-based sentiment analysis tool for analyzing social media text data. It uses a lexicon of words and their associated sentiment scores to calculate the overall sentiment of a piece of text. Rule-based models such as VADER are fast in operation, but these models cannot be effectively fine-tuned based on text context. Furthermore, VADER cannot extract aspects of text and assigns a polarity label to the entire text. Even if we extract the aspects of the text with methods like spaCy or LDA concept, VADER cannot assign separate polarity labels to the extracted aspects. This weakness causes us to assign the same polarity to tweets that comment on several cryptocurrencies, which can interfere with predicting the trend of cryptocurrencies [23].

Pano et al. used VADER to predict the closing price and showed the correlation of tweet sentiment scores with the price of Bitcoin during the COVID-19 pandemic. They collected Twitter data and used VADER’s sentiment analysis to calculate sentiment scores for tweets. Then, they used these points to predict the closing price of digital currencies [12].

Poongodi et al. presented the HyVADRF model, a hybrid approach combining a semantic VADER sentiment analysis, a random forest classifier, and parameter tuning using the gray wolf optimizer. Their study explores the relationship between Twitter sentiments and Bitcoin behavior in emerging markets. They collected over 3.6 million tweets, experimented with different dataset sizes, and found that the HyVADRF model achieved an F1-Score of 78%, with stable results [15].

Mohapatra, Ahmed, and Alencar introduced KryptoOracle, a platform based on Twitter sentiments for real-time and adaptive cryptocurrency price prediction. This platform employs a Spark-based architecture for data handling, supports real-time sentiment analysis, and utilizes online learning methods to adapt to new price and sentiment data. The authors emphasize that KryptoOracle can aid decision making, uncover opportunities, and provide timely insights into the ever-expanding world of financial data [6].

In another approach, transfer learning is used to predict the price trend of cryptocurrencies. The transfer learning technique can reduce the model’s sensitivity to the context of the text and make the model recognize the polarity of sentiments more accurately.

Frohmann et al. addressed the task of predicting the intraday price of Bitcoin by combining historical price data with sentiment analysis of microblogs. They introduced an approach using a fine-tuned BERT model for sentiment analysis and a unique weighting scheme based on the number of followers of each tweet’s creator. Their evaluation considers various Bitcoin price ranges to test the model’s robustness and generalization to market conditions. The results indicate that their hybrid models, employing linear regression for forecasting, outperform other methods with a MAE of 2.67 and RMSE of 3.28 [24].

Amirshahi and Lahmiri proposed a hybrid model to predict the daily close prices of cryptocurrencies, incorporating various neural networks like LSTM, CNN, and attention mechanisms. Using an ensemble of three pretrained language models, they harnessed sentiment data from cryptocurrency-related tweets posted between January 1, 2021, and December 31, 2021. They found that sentiment data proved valuable in predicting prices for over 70% of the studied cryptocurrencies, highlighting the significant role of Twitter users’ emotions, opinions, and sentiment in cryptocurrency price prediction [25].

Davchev et al. presented a methodology for predicting Bitcoin prices by leveraging Twitter data and historical Bitcoin price information. Their approach involves using the pretrained deep learning model RoBERTa for sentiment analysis on tweets, combining daily sentiment data with historical Bitcoin prices, and employing autoregressive models for time series forecasting to predict the next day’s Bitcoin price. Their findings demonstrate that modern techniques in sentiment analysis, time series forecasting, and transfer learning are effective for predicting Bitcoin prices when incorporating sentiment data from financial microblogs [26].

Although much research has been done in predicting the price trend of cryptocurrencies with social network sentiments, the following research gaps have been ignored in most articles.
  • Presented models (even deep learning models) for sentiment analysis in most articles do not consider aspects of the text. Therefore, assigning polarity to tweets that comment on two or more different cryptocurrencies causes the model to misunderstand the market behavior and, as a result, make a wrong price trend prediction.

  • The models used for sentiment analysis in most research are trained for general texts. Obviously, the structure of the type of tweets related to expert opinions in different fields, such as cryptocurrency, is different from general tweets, and the model needs to be fine-tuned. Therefore, using pretrained models for sentiment analysis in specialized fields can decrease model efficiency. Also, rule-based tools like VADER, in addition to being unable to extract chunks of text, cannot be effectively fine-tuned for context-specific sentiment analysis.

  • In most of the research, the period has been considered fixed, and this period has not been looked at as a hyperparameter. We know that the fluctuations of cryptocurrencies are different, so considering a fixed period for several cryptocurrencies makes the model unable to predict the price trend of cryptocurrencies accurately.

  • According to the studies of Mai et al., the importance of opinions in social networks is different [18]. Therefore, assigning the same value to tweets weakens the model’s performance in predicting the price trend of cryptocurrencies. In addition, assigning the IC based on the number of followers of a user causes some specialized and critical tweets related to users with fewer followers to be ignored. Therefore, this research assigns the normalized IC to each tweet based on its popularity and importance (number of retweets, likes, and replays).

3. HDBA + HBA Models

In this section, we first provide brief definitions of transfer deep learning and the DistilBERT pretrained model. Then, we will check how to extract tweets and historical prices of eight cryptocurrencies. The following explains how to preprocess tweets, extract aspects, and analyze aspect-based sentiments with the HDBA model. Finally, we describe how to combine the historical prices of cryptocurrencies and the sentiment score and predict the price trend of cryptocurrencies with the HBA model.

3.1. Deep Transfer Learning and DistilBERT Pretrained Model

Deep transfer learning is a machine learning paradigm that leverages the knowledge acquired from one or more source domains to improve the performance of a model on a target domain, where source and target domains may differ in their data distributions or task objectives. Mathematically, it can be defined as follows [27].

Let S represent the source domain with data distribution Ps and task objective Ts, and T denotes the target domain with data distribution PT and task objective TT. Deep transfer learning aims to find a mapping function F parameterized by θ that can adapt a pretrained model from the source domain to the target domain, improving performance on the target task TT. This adaptation can be represented as
()
where Fθ(S) signifies the adapted model and ≈ denotes the improvement in performance on the target task, measured by relevant metrics, and the adaptation process minimizes the discrepancy between source and target domains in feature space or task-specific loss. This can be formulated as a minimization problem as
()
where represents the task-specific loss and denotes a domain discrepancy measure. Deep transfer learning encompasses various techniques, such as domain adaptation, domain generalization, and few-shot learning, aiming to improve the model’s performance on the target domain by transferring knowledge from the source domain(s). DistilBERT pretrained model is used here [32].
A pretrained DistilBERT model is a variant of the original BERT model. In mathematical terms, DistilBERT can be represented as
()
where Mpre−trained is the pretrained model, represents the cross-domain dataset, and ˆpre−train denotes the learned parameters during pretraining. The pretraining process aims to learn a contextualized representation of language from a large text corpus.
DistilBERT differs from BERT in that it is a distilled version, meaning it is a smaller, compressed model that retains much of the original BERT’s knowledge but with fewer parameters. This can be represented as
()
where Mdistillbert is the distilled model and ˆDistill represents the parameters specific to the distillation process. To transfer knowledge from a pretrained model like DistilBERT to a target domain, such as SemEval, we can fine-tune the model on task-specific data from the target domain while retaining the pretrained knowledge. This can be formulated as
()
where Mfine−tune is the fine-tuned model, ˆfine−tune represents the parameters fine-tuned on the target domain data, and is the target domain dataset. The goal is to minimize the task-specific loss on the target domain while leveraging the pretrained knowledge as
()
where is the task-specific loss on the target domain data and is a regularization term that encourages the model to preserve its pretrained knowledge. λ is a hyperparameter that controls the trade-off between the two loss terms. This way, knowledge from the pretrained model is transferred and adapted to the target domain, improving the model’s performance on the specific task in the target domain while benefiting from the general language understanding learned during pretraining.

3.2. HDBA Model

In this section, we first discuss how tweets are extracted and preprocessed and then examine the training of the DistilBERT with cross-domain data, and finally, we describe the architecture of HDBA.

3.2.1. Preprocessing and Tweet Extraction

In this research, tweets related to the opinions of 70 influencers who are experts in cryptocurrencies have been used to predict their price trends. These tweets were extracted by the Apify site API using the influencers’ id [7]. The tweets are related to the period of the first six months of 2023, which are introduced in the datasets section. Then, preprocessing is done on the extracted tweets. Text preprocessing includes equalization, removal of punctuation marks, tokenization, removal of stopwords, and lemmatization. In addition, we added two special steps to the text preprocessing process due to the difference between the literature of tweets and general texts. These two steps consist of converting emojis to text with the demojize function of the emoji package and removing tweets with less than five characters to reduce the neutral polarity in the dataset.
  • Equalization: All letters of tweets are converted to lowercase letters to obtain integrated data for analysis.

  • Punctuation: All punctuations such as question marks, parentheses, dots, and commas, which do not affect data analysis, are removed.

  • Stopwords: The next step in data preparation is to remove stopwords. First, redundant words and words that cannot be predicted are identified. These words are variable based on the purpose of the research. For this purpose, we used the combination of two stopwords related to the NLTK package in Python and the specialized collection of sentiment analysis stopwords in GitHub.

  • Tokenization: Nontext signs were removed, and each word was converted into a separate token. Here, we use TensorFlow tokenization.

  • Lemmatization: The main goal of lemmatization is to convert derived and reflexive words into their original form or root to better extract their true meaning in the text. This work leads to increasing the frequency of each word and reducing the different forms of a word in the dictionary. We have used WordNetLemmatizer of NLTK package for lemmatization.

The process of extracting and cleaning tweets and transferring them to the HDBA + HBA model is shown in Figure 3.

Details are in the caption following the image
The process of extracting and preprocessing tweets of influencers.

However, preprocessed tweets are unlabeled; on the other hand, pretrained models such as DistilBERT are trained on an extensive collection of public texts and vocab. Therefore, without fine-tuning these models, transferring their knowledge to analyze the sentiments of specialized texts such as cryptocurrencies can lead to a negative transfer phenomenon and reduce the model’s efficiency [33]. One of the standard techniques in transfer learning to adapt the pretrained models to the target domain task is to use cross-domain datasets.

SemEval Task5 (2014) Laptop datasets and SEntFiN economic news headlines [34] have been used in this research. SemEval is a collection of tweets of general trends published yearly. In this research, the opinions of SemEval restaurant customers were not used to reduce negative changes. The results show that laptop and SEntFiN datasets correlate more with cryptocurrency tweets. In addition, the Bitcoin1 tweet dataset is used to increase the knowledge of the model and familiarity with cryptocurrency tweets. It is essential to mention that Bitcoin tweet alone is insufficient to train the HDBA model because this dataset is not aspect-based. The Bitcoin dataset only helps the model familiarize itself with tweets and cryptocurrency correction literature.

3.2.2. HDBA Model

HDBA is a combination model of feature extraction layer with the spaCy model, DistilBERT, BiGRU, and attention layer. This model receives the input data, cleans tweets according to Figure 3, and recognizes the aspect and polarity of their emotions.

SpaCy solves the ABSA challenge on tweets referring to multiple cryptocurrencies in the proposed framework. Utilizing named entity recognition (NER) and dependency decomposition, spaCy allows the model to accurately extract and identify the cryptocurrencies mentioned in a tweet. This feature is essential in cases where multiple cryptocurrencies, such as Bitcoin, Ethereum, and Litecoin, are mentioned simultaneously in the same sentence or text. In this research, identifying aspects is more straightforward because the aspects in question are the same cryptocurrencies usually mentioned in full or using abbreviations (such as BTC for Bitcoin). Also, in most cases, cryptocurrency names are preceded by a hashtag (#) or a dollar sign ($), which helps identify entities more precisely. Once the cryptocurrencies are identified as distinct entities, a hybrid model of DistilBERT, attention layer, and BiGRU is used to analyze the sentiment associated with each entity. This approach ensures that sentiment scores are calculated and analyzed for each cypher separately, avoiding their aggregation for all cyphers in the text. For example, if a tweet says, “Bitcoin is rising, but Ethereum is falling,” spaCy will correctly identify “Bitcoin” and “Ethereum” as separate entities. The model then uses ABSA to determine whether the “UP” is related to Bitcoin and the “DOWN” is related to Ethereum, assigning the appropriate sentiment scores to each. With spaCy’s advanced entity detection capabilities, the proposed framework effectively analyzes tweets that mention multiple cryptocurrencies simultaneously and accurately extracts sentiments related to each of them. This feature helps to increase the accuracy of predicting the prices of various cryptocurrencies.

Table 3 shows an example of the performance of the HDBA model along with the process of cleaning tweets.

Table 3. An example of preprocessing and applying the HDBA model to tweets.
Original tweet image#Bitcoin continues to shine as a beacon of financial innovation and opportunity, while I can’t help but feel a bit frustrated with @binance’s recent service hiccups and fees. Time to explore other crypto platforms? image #Crypto #Binance”
Emoji to text Rocket Bitcoin continues to shine as a beacon of financial innovation and opportunity, while I can’t help but feel a bit frustrated with Binance’s recent service hiccups and fees. Time to explore other crypto platforms? Thinking face Money bag Crypto Binance
Equalization (converting to lowercase) Rocket bitcoin continues to shine as a beacon of financial innovation and opportunity, while i can’t help but feel a bit frustrated with binance’s recent service hiccups and fees. Time to explore other crypto platforms? Thinking face money bag crypto binance
Remove stopwords and punctuation Rocket bitcoin continues shine beacon financial innovation opportunity can’t help feel bit frustrated binance’s recent service hiccups fees time explore crypto platforms thinking face money bag crypto binance
Lemmatization Rocket bitcoin continue shine beacon financial innovation opportunity can’t help feel bit frustrate binance’s recent service hiccup fee time explore crypto platform thinking face money bag crypto binance
Tokenization [“Rocket,” “bitcoin,” “continue,” “shine,” “beacon,” “financial,” “innovation,” “opportunity,” “can’t,” “help,” “feel,” “frustrate,” “binance,” “recent,” “service,” “hiccup,” “fee,” “time,” “explore,” “crypto,” “platform,” “thinking,” “face,” “money,” “bag,” “crypto,” “binance”]
HDBA Aspect: Bitcoin sentiment: Positive sentiment score (normalized): +0.87
Aspect: Binance sentiment: Negative sentiment score (normalized): −0.65

After cleaning, the tweets are injected into the embedding layer, which helps to determine the relationships between the words of the tweet. Here, DistilBERT model capabilities are used to build the embedding layer. The embedding layer transforms textual inputs (such as tweets) into a vector space to represent semantic information and relationships between words in the text. Then, the output of the embedding layer is fed to the spaCy model to extract tweet features.

We utilized the spaCy model to extract aspects from tweets. Let MspaCy represent the spaCy model designed explicitly for aspect extraction from tweets. Given a tweet T as a sequence of words or tokens, the model’s task is to identify and extract aspects A from the tweet, where aspect ai is a specific entity or attribute mentioned in the tweet. This can be expressed mathematically as
()

Here, A is the set of extracted aspects from the tweet T, and MspaCy is the model responsible for performing the aspect extraction. After the spaCy model extracts the features, this information is transferred to the DistilBERT that has already been fine-tuned by the three datasets SemEval, SEntFiN, and Bitcoin tweets.

Let T represent an input tweet and A denote the aspects extracted from the tweet using spaCy. The transformation of data begins with the integration of these aspects into the tweet, generating an augmented input X for further processing mathematically as
()
The augmented data X are then input into the DistilBERT model, which produces a sequence of hidden states HBERT as
()
To capture contextual information, the data undergo additional processing through a BiGRU, resulting in a new sequence of hidden states HBiGRU as
()
Bidirectional analysis facilitates the modeling of context and dependencies within the data. Subsequently, a self-attention mechanism is employed on HBiGRU to identify and emphasize essential sections, generating an attention-enhanced representation HAttention as
()
Self-attention is a mechanism that computes weighted combinations of different sequence parts, allowing the model to focus on essential elements while processing data. When used after a BiGRU, self-attention enhances the model’s ability to capture long-range dependencies and context within the sequence, providing valuable insights into relevant data sections. This aids in tasks like sentiment analysis and aspect extraction by improving the model’s understanding of the most informative segments of the input, thereby enhancing its overall performance. The outputs from both the BiGRU and self-attention layers are combined through concatenation as
()
To mitigate overfitting, dropout regularization is applied to Hconcatenated with a specified dropout rate ρ as
()
Finally, aspect and sentiment information is extracted using a dense layer with softmax activation, yielding the output O as
()

After removing the neutral polarities due to the upward or downward trend of cryptocurrencies, the output of the HDBA model is the aspect of each tweet, the polarity of the sentiments of the aspects, and the sentiment score of the polarities. This output is injected into the HBA model along with the historical prices of each cryptocurrency (open, high, low, close, volume—OHLCV).

3.3. HBA Model

This research has classified sentiments into three categories: positive, negative, and neutral. The HDBA model, as a hybrid model of deep neural networks and transfer learning, uses the capabilities of the DistilBERT and spaCy models to extract the semantic features of tweets and identify different aspects of the text. In this model, each aspect is analyzed separately after preprocessing the tweets. Its emotional polarity (positive, negative, or neutral) is determined using the attention layer and the BiGRU network. This method allows for a more detailed analysis of the multiple aspects contained in a tweet. It enables the model to independently assess the impact of each aspect on the price trend [24].

The direct correlation of sentiment with price changes is calculated using the majority vote average for each cryptocurrency on a given day. This method allows the model to quantitatively assess the impact of different sentiments on price changes. Previous research has shown that ABSA can improve the accuracy of financial market price predictions, especially when historical price data are also considered [35]. For example, our study found that an increase in positive tweets about Bitcoin over the next two days led to a rise in its price, while negative tweets led to a decrease in the price in the following days. These results are consistent with other studies investigating the impact of social sentiment on asset prices [3, 36].

The ABSA allows the HDBA model to provide a more accurate market analysis and avoid the negative effects of general sentiment. This enables the HBA to model and predict cryptocurrency price trends more accurately over the next 1–10 days based on daily sentiment fluctuations and price history.

Two different datasets of normalized values are injected into the HBA model to predict the price trend of cryptocurrencies. These data include OHLCV and the average sentiment score of tweets per day. To get the average sentiment per day representing the average majority vote of each influencer on cryptocurrency i on day j, first, we need to calculate the normalized IC using the following equation:
()
The reasons for choosing the number of retweets, likes, and replies in equation (15) are as follows:
  • Retweets coefficient: A coefficient of 2 is assigned to retweets, signifying their significant role in indicating a tweet’s reach and potential virality.

  • Likes coefficient: Likes, which reflect approval and popularity, receive a coefficient of 1.5 to signify their moderate importance.

  • Replies coefficient: Replies, indicating engagement and conversation, are assigned a coefficient of 1, considering them slightly less vital than retweets and likes.

The IC formula has the following properties:
  • Normalization: The formula normalizes the ICs between 0 and 1 to ensure fair assessment across varying engagement metrics.

  • Customization: The formula allows for customization, enabling researchers to adjust coefficients to align with their specific goals and priorities.

  • Comparability: Normalizing the coefficients ensures consistent tweet comparability, facilitating interpretation and analysis.

Another kind of data injected into the HBA model is the average sentiment score of daily tweets. This indicating average is generated based on the majority vote average for j cryptocurrency in i with the following equation:
()
For example, for Bitcoin on day i, we have 500 different tweets, 200 of which are positive and 300 of which are negative; if we assume that the IC for all tweets is the same and equal to 0.6, we have
()

In this example, the majority vote average for the first day and Bitcoin is −0.12. This result indicates that the sentiment opinion about Bitcoin is negative based on the tweets’ IC and sentiment scores.

In this research, a “trend” column has been created as a target column to predict cryptocurrency price changes in the dataset. For example, if the close price of cryptocurrency j on day i + 1 was higher than day i, the value 1 (positive) is placed in the trend column, and if it was less, the value 0 (negative) is placed. The API package of Yahoo Finance extracts the price information of cryptocurrencies.

After OHLCV normalization with the MinMax normalize algorithm, normalized OHLCV values and the majority vote average of cryptocurrency’s sentiments are injected into the BiGRU neural network. This neural network extracts the relationships between the data and the trend column (target column), and then the information is injected into the attention layer to discover important data. Next, the data are entered into the dense network after processing the information in the attention layer. Finally, the price trend of Jam cryptocurrency is predicted in 1–10 days. In the HBA model, the validation accuracy is monitored every time it is executed in 1–10 days, and the best accuracy is reported as the best time frame for predicting the price trend of Jam cryptocurrency. For example, suppose the best accuracy in predicting the price trend of Bitcoin is for the next three days. In that case, this shows that the opinions of influencers on social networks have the most significant effect on the price of Bitcoin after two days. This time frame is different for cryptocurrencies. Table 4 shows the HDBA + HBA pseudocode and its time complexity.

Table 4. Pseudocode of HDBA + HBA models.
1. Tweet PreprocessingAndAspectExtraction (Tweets):
 • EmbeddingLayer = DistilBERTEmbedding(Tweets) has a time complexity of O(n)
 • Aspects = AspectExtractionWithSpaCy(EmbeddingLayer) has a time complexity of O(m)
 • The overall time complexity for this function is O(n + m)
2. IntegrateAspects(Tweet, ExtractedAspects):
 • Concatenate(Tweet, ExtractedAspects) has a time complexity of O(p)
3. BERTBasedModel(Input):
 • H_BERT = DistilBERT(Input) has a time complexity of O(q)
 • H_BiGRU = BidirectionalGRU(H_BERT) has a time complexity of O(r)
 • H_Attention = SelfAttention(H_BiGRU) has a time complexity of O(s)
 • H_Concatenated = Concatenate(H_Attention, H_BiGRU) has a time complexity of O(t)
 • H_Dropout = ApplyDropout(H_Concatenated, ρ) has a time complexity of O(u)
 • Output = DenseLayer(H_Dropout) has a time complexity of O(v)
 • The overall time complexity for this function is O(q + r + s + t + u + v)
4. HDBAModel(Tweets):
 • ExtractedAspects = TweetPreprocessingAndAspectExtraction(Tweets) has a time complexity of O(n + m)
 • AugmentedInput = IntegrateAspects(Tweets, ExtractedAspects) has a time complexity of O(n + p)
 • AspectSentimentInfo = BERTBasedModel(AugmentedInput) has a time complexity of O(q + r + s + t + u + v)
 • The overall time complexity for this function is O(n + m + q + r + s + t + u + v)
5. HBAModel(OHLCVData, MajorityVoteAverage):
 • IC = CalculateImportanceCoefficient() has a time complexity of O(w)
 • NormalizedOHLCVData = MinMaxNormalize(OHLCVData) has a time complexity of O(x)
 • InputData = Concatenate(NormalizedOHLCVData, MajorityVoteAverage) has a time complexity of O(y)
 • PredictedPriceTrend = BiGRUWithAttention(InputData) has a time complexity of O(z)
 • The overall time complexity for this function is O(w + x + y + z)
In the proposed model, variability in the time frame of sentiment influence across different cryptocurrencies is handled through a combination of BiGRU and the attention mechanism. This design allows the model to capture the temporal dependencies of sentiment data as they impact price movements for each cryptocurrency, both in the short term and long term. Here is how it works:
  • 1.

    Temporal dependencies with BiGRU: The BiGRU is specifically designed to process sequential data, such as time series data, by understanding relationships between past and future points in time. By being bidirectional, it captures sentiment influences that may have delayed effects on price changes. For example, a tweet about Bitcoin may have an immediate impact, whereas Ethereum’s effect might manifest after a delay. This feature is crucial in handling the diverse response times of different cryptocurrencies to social sentiment. Studies have shown that recurrent neural networks, particularly GRU and LSTM models, are highly effective in capturing such time-dependent relationships in financial markets [37].

  • 2.

    Attention mechanism for focused learning: The attention mechanism ensures that the model focuses on the most relevant parts of the sentiment data for each cryptocurrency. It helps differentiate between critical sentiment indicators and noise by assigning higher importance to time intervals where significant price movements are expected. This mechanism prevents the model from treating all data points equally, which is particularly useful in volatile markets like cryptocurrency, where the relevance of sentiment can change rapidly. The attention mechanism has been widely adopted in time series forecasting for financial applications due to its ability to improve model precision by focusing on critical data points [35].

  • 3.

    Handling variability in sentiment impact: The variability in how different cryptocurrencies react to sentiment at various time frames can be a potential source of instability. However, by combining the BiGRU with the attention layer, the model dynamically adjusts to the sentiment response times of each cryptocurrency. For instance, while Bitcoin might react immediately to a tweet, another currency like Ripple may show a delayed reaction. By applying attention, the model can focus on the relevant time points for each asset and avoid confusion that could arise from mixing the responses of different assets over time. Research has shown that this combination of BiGRU and attention is particularly effective in improving the stability and accuracy of predictions in such high-variability environments [37].

  • 4.

    Mitigating model instability: Early stopping and regularization techniques are implemented to minimize the potential for model instability due to the varying time frames of sentiment influence. These techniques prevent overfitting to short-term fluctuations in the data, which may cause the model to misinterpret temporary noise as significant trends. As the literature supports, combining temporal models with attention layers can reduce the risk of instability in predictive models when applied to time-sensitive data like cryptocurrency prices [37].

In conclusion, the proposed model effectively handles the variability in the time frame of sentiment influence across cryptocurrencies by combining BiGRU and attention mechanisms. This hybrid method ensures that the model captures both immediate and delayed sentiment effects on prices while maintaining prediction stability and accuracy.

4. Experimental Result

Precision, recall, accuracy, F1-Score, and ROC-AUC charts were used to evaluate HDBA and HBA models. Table 5 shows the equations of these criteria.

Table 5. Metric equations.
Accuracy (ACC) = TP + TN/TP + TN + FP + FN
Precision (P) = TP/TF + FP
Recall (R) = TP/TF + FN
F1-Score = 2.P.R/P + R
ROC-AUC = ∫TP(FP)dFP

TP equals the number of cases the model correctly predicted positive, FP equals the number of cases the model incorrectly predicted positive, TN equals the number of correctly predicted negative instances, and FN equals the number of positive instances incorrectly predicted as negative.

4.1. Datasets

This research uses three datasets of SemEval 2014 Task 4: AspectBasedSentimentAnalysis-Laptop, SEntFiN1.1, and Bitcoin tweets-16 M tweets with sentiment tagged. In Table 6, two datasets, Bitcoin and SemEval2014, are compared.

Table 6. SemEval and bitcoin datasets.
Database Tweet no. Positive (%) Negative (%) Neutral
SemEval 2014 1482 43 37 21%
Bitcoin tweets 14,876,179 53 47

The Bitcoin dataset has been used due to the increased knowledge of the HDBA model in the face of cryptocurrency tweets. This dataset helps to increase the range of HDBA model words in cryptocurrencies. SEntFiN economic news headline dataset, which includes more than 10 thousand economic news headlines, is shown in Table 7.

Table 7. SEntFiN dataset.
Type Aspect no. Positive Negative Neutral Overall
Single entity 7906 2837 2376 2693 7906
Multiple entity 2847 2237 1438 2823 6489
Overall 10,753 5074 3814 5516 14,044

Using the SEntFiN dataset is essential and influential in training the HDBA model. This dataset contains economic news headlines that can help to adapt the model to the task of facet-based sentiment analysis of cryptocurrency tweets. Another point is the official but short expression of economic news, which can reduce the sensitivity of the HDBA model to the context of the text. In other words, the proposed model with training by the SEntFiN dataset shows a lower performance loss when dealing with tweets that have official literature. Another dataset used in this research (in the target domain) is a part of the database of influencers’ tweets in cryptocurrency. This dataset was collected over six months between January 02, 2023, and June 12, 2023, and includes 16,511 tweets from 70 influencers about more than 150 cryptocurrencies. The output of the HDBA model on this dataset is the aspect (the same as the names of the codes), the polarity, and the sentiment score of the tweets. The output is combined with the historical data of each cryptocurrency and injected into the HBA model to predict the price trend of eight currencies.

In this study, the cosine similarity with equation (18) has been used to select the datasets for training the backbone of the HDBA model.
()

Here, A and B represent the vector of tweets’ characteristics, and ‖A‖ and ‖B‖ also represent the Euclidean distance or magnitude of vectors A, B. Table 8 shows the cosine similarity of SemEval 2014 Task 4: AspectBasedSentimentAnalysis-Laptop, SEntFiN1.1, and Bitcoin tweets-16 M tweets with sentiment tagged dataset with the database of influencers’ tweets in cryptocurrency dataset.

Table 8. Cosine similarity dataset.
Datasets Cos-Sim
SemEval2014-Laptop 0.635
SEntFiN 0.632
Bitcoin tweets 0.701

The results of Table 8 show that all three selected datasets have a high correlation with the dataset of influencers’ tweets, which causes the risk of negative transfer to be reduced to some extent.

4.2. Fine-Tuning HDBA and HBA Models

The grid search method has been used to select the hyperparameters of HDBA and HBA models. Grid search is a hyperparameter tuning technique to systematically search for a given model’s optimal combination of hyperparameter values. It involves evaluating the model’s performance using different combinations of hyperparameters from predefined ranges and selecting the combination that results in the best performance according to a specified evaluation metric.

Let H represent the set of hyperparameters for a machine learning model, where H = {h1, h2, …, hn}, and n is the number of hyperparameters to be tuned. For each hyperparameter hi, let Di represent the set of possible values or a predefined range for that hyperparameter, where Di = {di1, di2, …, dim}, and m is the number of values or steps considered for hi.

The grid search algorithm explores all possible combinations of hyperparameters by taking a Cartesian product of the sets of values for each hyperparameter. This results in a grid of hyperparameter combinations to be evaluated. Let C represent the Cartesian product of sets Di for all i = 1, 2, …, n, where C = D1D2∗ ⋯ ∗Dn. For each combination of hyperparameters cjC, the machine learning model is trained and evaluated using cross-validation or another evaluation method with a specified performance metric, denoted as M(cj).

Grid search aims to find the hyperparameter combination c that maximizes or minimizes the chosen performance metric by
()

Once the optimal hyperparameter combination c is determined, it is used to train the final model for making predictions on unseen data.

However, using grid search dramatically increases the computational complexity of the method, so it is recommended to save the stable model after determining the hyperparameters with methods such as grid search and train the model in the background if it needs to be tuned again. This study examined hyperparameters of learning rate, BiGRU units, and learning rate according to Table 9.

Table 9. Grid search hyperparameters.
LR [1e − 5, 1e − 4, 1e − 3]
BUs [32, 64, 128]
DR [0.1, 0.2, 0.5]

The evaluation results of the HDBA model on the SemEval 2014 dataset with different hyperparameters are shown in Table 10.

Table 10. HDBA hyperparameter evaluation.
Hyperparameters Avg. accuracy Avg. F1-Score
LR: 1e − 5, BU: 32 DR = 0.1 ≥ 64.21 62.21
DR = 0.2 ≥ 65.88 62.35
DR = 0.5 ≥ 67.58 64.72
  
LR: 1e − 5, BU: 64 DR = 0.1 ≥ 68.21 63.12
DR = 0.2 ≥ 69.05 66.35
DR = 0.5 ≥ 69.96 67.01
  
LR: 1e − 5, BU: 128 DR = 0.1 ≥ 73.08 70.58
DR = 0.2 ≥ 77.58 74.68
DR = 0.5 ≥ 74.02 71.08
  
LR: 1e − 4, BU: 32 DR = 0.1 ≥ 62.01 59.98
DR = 0.2 ≥ 63.23 61.05
DR = 0.5 ≥ 65.4 62.39
  
LR: 1e − 4, BU: 64 DR = 0.1 ≥ 64.52 62.87
DR = 0.2 ≥ 65.19 63.45
DR = 0.5 ≥ 67.28 64.2
  
LR: 1e − 4, BU: 128 DR = 0.1 ≥ 70.58 68.65
DR = 0.2 ≥ 72.41 69.97
DR = 0.5 ≥ 73.95 71.3
  
LR: 1e − 3, BU: 32 DR = 0.1 ≥ 61.31 58.97
DR = 0.2 ≥ 63.5 60.28
DR = 0.5 ≥ 65.02 62.66
  
LR: 1e − 3, BU: 64 DR = 0.1 ≥ 65.33 62.3
DR = 0.2 ≥ 66.21 64.41
DR = 0.5 ≥ 67.89 65.56
  
LR: 1e − 3, BU: 128 DR = 0.1 ≥ 66.63 64.32
DR = 0.2 ≥ 68.21 65.25
DR = 0.5 ≥ 69.05 68.1
  • Note: Bold values represent the significant values.

Table 10 shows that the best performance is obtained by setting the hyperparameters of the HDBA model as LR: 1e-5, BU: 128, and DR = 0.2. Table 11 shows the parameters and config values of HDBA and HBA.

Table 11. HBDA and HBA config.
AHDT tokenizer and pretrained model DistillBert
BiGRU units 128
Learning rate 1e − 5
Dropout rate 0.2
Attention Self-attention
Activations ReLU, in dense layer {softmax}
Optimizer Adam
Epochs 50
EarlyStopping monitor = “val loss,” patience = 5
Loss Binary/categorical cross entropy

The exact parameters of the HDBA model are used because the results show that these parameters also perform well on the HBA. EarlyStopping is due to the prevention of overfitting of the learning model. In this technique, if the model’s error on the test data in the “i + 1” execution is more than the “i” execution, it monitors the model by the number of patience. If the error does not decrease, it stores the desired model obtained in the i_i’th execution.

4.3. Experimental Results

In this section, we first examine the efficiency of the HDBA model for the aspect-oriented sentiment analysis task. Then, we examine the effectiveness of the HBA model in predicting the price trend of eight cryptocurrencies. Undoubtedly, the optimal efficiency of the HDBA model significantly affects the efficiency of the HBA model because the HDBA produces the input part of the HBA model.

4.3.1. The HDBA Results

To show the efficiency of the HDBA model, the ROC-AUC chart in Figure 4 is used. The ROC-AUC plot shows how accurately the model has calculated each polarity. Therefore, if a model is weak in calculating a polarity or is biased and assigns most of the tweets to a specific polarity, it is evident in this diagram.

Details are in the caption following the image
Evaluation of the HDBA model on the SemEval 2014-Laptop dataset.

It can be seen in Figure 4 that the HDBA model has been able to distinguish positive, negative, and neutral polarities with almost the same accuracy on the unbalanced SemEval dataset. In this diagram, “0” indicates positive polarity, “1” indicates neutral polarity, and “2” indicates negative polarity.

In Table 12, the efficiency of the HDBA model is compared with other previous studies on the SemEval dataset. In this table, the HDBA model is compared with the following methods:
  • GCAE [38] employs CNNs for text feature extraction, followed by incorporating aspect-specific embedding into the feature maps. This enables the gated units to discern sentiment features related to specific aspects. GCAE initializes its aspect embeddings using pretrained Glove word embeddings.

  • ATAE-LSTM [39] incorporates an attention mechanism into LSTM to selectively encode aspect-related context into textual representations. The attention component assesses the significance of each word within a sentence concerning the aspect information and subsequently combines aspect embeddings with textual attributes. ATAE-LSTM employs aspect embeddings initially generated with random values within the range of [−0.01, 0.01] following a uniform distribution.

  • GCAE AAE [40]: The AAE approach fine-tunes aspect-category embeddings, bringing them nearer to their corresponding aspect-terms within the representation space. The AAE method refines aspect embeddings based on the connections between aspect-categories and aspect-terms.

  • ASGCN [36]: ASGCN utilizes a graph convolutional network (GCN) to capture extensive connections and intricate semantic intricacies embedded in the dataset.

  • CPA-SAA [41]: In this study, an innovative approach is presented for aspect-level sentiment analysis, incorporating aspect-specific contextual position information (CPA-SA). By accounting for the distinct relative positions of specific aspects within sentences, the paper introduces two distinct positional weighting functions, one fixed and the other adaptive. These functions dynamically adjust the significance of contextual words at varying positions, ultimately elevating the precision in identifying sentiment words associated with specific aspects.

Table 12. HDBA comparison with the state of the art.
Models ACC F1-Score
GCAE 65.06
ASGCN 74.14 69.24
GCAE AAE 67.82
CPA-SAA 75.18 71.50
HDBA 77.58 74.68
  • Note: The bold values represent the significant values.

Table 12 shows that the HDBA model has improved the accuracy by about 2% and the F1-Score by about 3%. The improvement of F1-Score is significant because F1-Score is obtained from the combination of precision and recall, which proves that for unbalanced datasets, the model has not been oriented toward the polarity with a high majority. This position is also shown in Figure 4.

We also used the statistical significance of the observed improvements in accuracy and F1-Score. One of the standard methods to evaluate the importance of slight differences in the performance of models is to use a paired t-test or Wilcoxon signed-rank test. These tests help examine performance differences between models and determine whether these differences are statistically significant or occurred by chance. Here, we combined the statistical and ablation tests and investigated the two proposed models (HDBA) and the baseline model on the SemEVal dataset.
  • Baseline model: This is the basic model in which BERT is used for sentiment analysis, and GRU is used for time series data analysis. This model lacks ABSA and attention layer and performs sentiment analysis in general.

  • Proposed model (HDBA): The HDBA model includes improvements such as DistilBERT for ABSA, BiGRU for better processing of time series data, and an attention layer to focus on more essential parts of the input data. These changes have led to an increase in accuracy criteria and F1-Score.

We compared the improvement of accuracy and F1-Score criteria in the proposed model (HDBA) to the baseline model, which is statistically significant. The following two statistical tests have been used [42, 43].
  • 1.

    Paired t-test: This test compares the averages of two related groups (here, the performance of the basic model and the proposed models’ performance). If the p value is less than 0.05, it indicates that the differences are statistically significant.

  • 2.

    Wilcoxon signed-rank test: This nonparametric test evaluates the differences between the models if the data do not have a normal distribution.

Table 13 shows the results of these two tests.

Table 13. The results of the statistical comparison of the HDBA model and the baseline.
p value (Wilcoxon test) p value (paired t-test) Proposed model (mean ± std. dev) Baseline model (mean ± std. dev) Metric
0.017 0.015 77.58 ± 1.0 70.5 ± 1.2 Accuracy
0.025 0.021 74.68 ± 1.1 68.05 ± 1.5 F1-Score

Table 13 shows that the HDBA model shows an improvement of 2%–3% compared to the base model in terms of accuracy and F1-Score. Although these improvements may seem small, in the context of cryptocurrency price prediction, this increase in accuracy is practically significant. The results of statistical tests also confirm these improvements. The p value of the paired t-test for accuracy and F1-Score was reported as 0.015 and 0.021, respectively, which are less than the significance level of 0.05. This indicates that the observed improvements are statistically significant and cannot be attributed to random variation. Also, the Wilcoxon test has provided similar results, and p values of 0.017 and 0.025 show that the results of the proposed model are significantly better than the basic model. This statistical analysis shows that the improvements observed in the proposed model (HDBA) compared to the baseline model are statistically significant, and these improvements cannot have occurred by chance or due to overfitting.

4.3.2. Ablation Study

Two ablation experiments have been performed on the HDBA model in this section. The first test is on a compound sentence that the model has not seen so far, and the second test is on the entire SemEval dataset using two HDBA models and the baseline model. To examine the effect of removing different components of the HDBA model on its efficiency, we selected a random sentence from the SemEval-Laptop 2014 dataset. The baseline model (base BERT), Xl-NET, and HDBA analyze how each component, such as the BiGRU and attention layer, influences the model’s performance. These results are listed in Table 14.

Table 14. Ablation analysis with a case study.
Baseline Xl-NET HDBA Case study
(Camera, neu) (Camera, pos) (Camera, pos) The camera quality of this phone is fantastic
(Battery, neg) (Battery, neg) (Battery, neg) But the battery life is disappointing
  • Note: Sentence: The camera quality of this phone is fantastic, but the battery life is disappointing.

As seen in Table 14, the HDBA model has been able to detect the “camera” aspect as “positive correctly” and the “battery” aspect as “negative.” Using the attention layer and BiGRU in this model has enabled the model to focus on the critical parts of the sentence and analyze each aspect correctly. On the other hand, although the Xl-NET model has the same performance as the HDBA model in this case, it is much more expensive and slower than DistilBERT in terms of implementation and execution time. Also, the model’s performance drops without a rich training dataset. In the baseline model, the emotions associated with the “camera” aspect have been wrongly recognized as neutral, which indicates that the absence of the attention layer, BiGRU, and the DistilBERT model has led to a decrease in the accuracy of the model in identifying emotions. In the conclusion of this study, it is clear that the combined use of the DistilBERT style model with a rich training dataset with BiGRU and the attention layer improves the accuracy of the model in identifying aspects and emotions associated with them and removing these components; as observed in the baseline model, it leads to a decrease in accuracy and the occurrence of errors in sentiment analysis.

In the following, we performed the ablation study using three basic HDBA and modified models on the SemEval dataset. The base model employs GRU and the base BERT, and the attention layer of the table has been removed. In the modified BiGRU and DistilBERT model, there is no attention layer. In Table 15, the efficiency of these models is compared with each other on the SemEval dataset.

Table 15. Ablation study on SemEval.
Model configuration Accuracy (%) F1-Score (%) p value (paired t-test) p value (Wilcoxon test)
Baseline model (BERT + GRU) 70.5 68.5 0.015 0.017
HDBA model (DistilBERT + BiGRU + attention layer) 77.58 74.68 0.021 0.025
DistilBERT + BiGRU (no attention) 73.15 70.2 0.017 0.19
DistilBERT (no BiGRU, no attention) 71.65 70.9 0.019 0.023
Table 15 shows the following results.
  • The HDBA model showed the highest accuracy and F1-Score, confirming that the combination of DistilBERT, BiGRU, and the attention layer provides the best performance. The accuracy and F1-Score improvement compared to the baseline model is statistically significant, as indicated by the low p values (0.015 and 0.017), confirming that the improvement is not due to chance.

  • By removing the attention layer in the HDBA model, a significant drop in accuracy and F1-Score is observed. However, the p values are still substantial (p = 0.028 and 0.035). This shows that the attention mechanism is essential in improving the model’s performance by focusing on the critical parts of the input data.

  • In DistilBERT without BiGRU and attention layer configuration, the performance is reduced, almost matching the base model’s performance. These results suggest that the attention mechanism and BiGRU are critical for superior results.

The results of the erosion study confirm that each component of the proposed model contributes to its overall performance. The attention layer and BiGRU are essential in the model’s ability to accurately capture temporal dependencies and focus on key features, especially for ABSA.

4.3.2.1. The HDBA Results

The HBA model uses historical prices and the average sentiment score of influencers on Twitter to predict the price trend of cryptocurrencies. This time interval model considers the price trend as a hyperparameter for each cryptocurrency and shows that the time interval of the impact of sentiments and historical price on the price trend is different in each cryptocurrency. As far as we know, no research has yet addressed the issue of the best duration of social network emotions on cryptocurrencies.

In the graphs of Figure 5, the best performance of the HBA model for predicting the price trend of eight different cryptocurrencies in the time intervals of 1–10 days is shown based on the criteria of loss and accuracy.

Details are in the caption following the image
Analysis of loss and accuracy of the HBA model in predicting the trend of cryptocurrencies.
Details are in the caption following the image
Analysis of loss and accuracy of the HBA model in predicting the trend of cryptocurrencies.
Details are in the caption following the image
Analysis of loss and accuracy of the HBA model in predicting the trend of cryptocurrencies.
Details are in the caption following the image
Analysis of loss and accuracy of the HBA model in predicting the trend of cryptocurrencies.
Details are in the caption following the image
Analysis of loss and accuracy of the HBA model in predicting the trend of cryptocurrencies.
Details are in the caption following the image
Analysis of loss and accuracy of the HBA model in predicting the trend of cryptocurrencies.
Details are in the caption following the image
Analysis of loss and accuracy of the HBA model in predicting the trend of cryptocurrencies.
Details are in the caption following the image
Analysis of loss and accuracy of the HBA model in predicting the trend of cryptocurrencies.

In Figure 5, it can be seen that the influence of Twitter influencers’ sentiment and historical price on cryptocurrencies is different. In this figure, in addition to accuracy, the amount of loss is also considered, and the best time interval can be a trade-off between loss and accuracy. For the AMP token, it can be seen in Figure 5(a) that the best impact time is the next nine days. However, it can be seen that by accepting a small amount of loss, the next four days can also be considered a good time to predict the price trend of AMP. Regarding Binance, shown in Figure 5(b), the best future days to predict the price trend are the next 2 and 6 days, respectively. However, it can be seen that if we accept a small amount of accuracy loss, the next six days for predicting the trend of Binance have a lower loss.

Regarding Bitcoin, as seen in Figure 5(c), considering both loss and accuracy criteria, the best time to impact Twitter sentiments is the next two days. It can be said that Twitter comments have a faster impact on Bitcoin’s trend because Bitcoin’s market cap is more significant than other cryptocurrencies and is known as a safe and valuable asset. In Figure 5(d), it can be seen that the best time for the impact of emotions for Ethereum is related to the time frame of the next eight days. Of course, in the 2 to 4 time frame, accepting a slight drop in accuracy can be attractive for investment. The next token examined in Figure 5(e) is the Polygon. This figure shows that the best time for the impact of Twitter emotions in this cryptocurrency is for the next 5-4 days. Of course, by accepting a small amount of accuracy loss (about 2%), five days is also suitable.

Regarding Ripple, shown in Figure 5(f), the best adequate time is for the next six days. In the case of Shiba, considering loss and accuracy, the best time is for the next 1 and 4 days, as shown in Figure 5(g). The last cryptocurrency under investigation is the Solana cryptocurrency, which is shown in Figure 5(h). Solana’s best effect time is one, 4, and 5 days ahead.

For a more accurate evaluation of the HDA model, in Table 16, the precision and accuracy (test data) of the prediction of the price trend of eight different cryptocurrencies are shown in 1–9 days. The tenth day is not reported due to a severe drop in accuracy and loss in all cryptocurrencies.

Table 16. HAD period time prediction.
Days 1 2 3 4 5 6 7 8 9
Bitcoin Pre: 0.55 0.69 0.65 0.53 0.53 0.56 0.58 0.58 0.60
ACC: 0.49 0.618 0.612 0.49 0.49 0.49 0.51 0.51 0.52
  
Ethereum Pre: 0.70 0.69 0.71 0.69 0.69 0.46 0.65 0.74 0.65
ACC: 0.59 0.57 0.60 0.61 0.54 0.38 0.50 0.67 0.57
  
Solana Pre: 0.69 0.68 0.35 0.67 0.65 0.41 0.62 0.64 0.68
ACC: 0.63 0.64 0.26 0.63 0.63 0.38 0.50 0.51 0.57
  
Ripple Pre: 0.65 0.71 0.61 0.65 0.45 0.76 0.52 0.56 0.51
ACC: 0.57 0.63 0.51 0.51 0.37 0.68 0.43 0.45 0.44
  
Binance Pre: 0.73 0.69 0.68 0.83 0.68 0.65 0.70 0.71 0.68
ACC: 0.43 0.66 0.51 0.38 0.56 0.61 0.46 0.46 0.53
  
AMP Pre: 0.658 0.736 0.754 0.66 0.68 0.67 0.67 0.69 0.64
ACC: 0.62 0.53 0.51 0.64 0.57 0.6 0.62 0.57 0.66
  
Shiba Pre: 0.795 0.45 0.47 0.74 0.35 0.38 0.67 0.42 0.46
ACC: 0.70 0.35 0.35 0.67 0.21 0.26 0.66 0.36 0.38
  
Polygon Pre: 0.69 0.78 0.61 0.87 0.82 0.53 0.63 0.66 0.76
ACC: 0.59 0.52 0.65 0.80 0.76 0.76 0.75 0.59 0.59
  • Note: The optimal prediction times for various cryptocurrencies based on accuracy (ACC) is shown. For Bitcoin, the highest accuracy occurs on days 2 and 3, with values of 0.618 and 0.612, respectively. For Ethereum, the best accuracy is noted on Day 8 at 0.67. Solana achieves its peak accuracy on Days 2 and 4, with a value of 0.64. In the case of Ripple, the highest accuracy happens on Day 6, registering at 0.68. Binance records its best accuracy on Day 2, reaching 0.66. AMP shows the highest accuracy on Days 4 and 9, at 0.64 and 0.66, respectively. Shiba demonstrates its most significant prediction accuracy on Day 1, attaining 0.70. Lastly, Polygon registers its highest accuracy on Days 4 and 5, recording values of 0.80 and 0.76, respectively.

Table 16 shows that the best time frame for the effect of sentiment and historical price on the cryptocurrency price trend (in terms of accuracy and precision criteria) is on the second, third, fourth, and sixth days. It can be concluded that the effect of influencers’ opinions on the market is visible after 3.75 average opinions of influencers. As seen in the table, prominent cryptocurrencies such as Bitcoin, Ethereum, Binance, and Solana will experience these effects, and other cryptocurrencies will be affected. Of course, the effect on Shiba on the first day is an exception, and this can be due to the excellent news, reasonable price, and constant watchlist of this token. In general, investors with access to the opinions of influential people can manage their stock portfolio in the short term and stay safe from market fluctuations by buying, selling, or keeping their assets to an acceptable extent.

Also, in Table 17, the HBA model is compared with the following studies.

Table 17. Comparing HDA and the state of the art to trend prediction.
Models Accuracy F1-Score
Singathala et al. [44] Bitcoin: 51.86%
  
Kiran and Stannett [28] Bitcoin: 0.51
Dash: 0.64
Ethereum: 0.57
Litecoin: 0.62
Ripple: 0.67
Monero: 0.65
Average: 0.613
  
Shintate and Pichl [45] Bitcoin: 0.626 0.536
  
HBA model (best days) Bitcoin: 0.618 0.591
Ethereum: 0.60 0.572
Ripple: 0.68 0.625
Solana: 0.64 0.593
Binance: 0.66 0.62
AMP: 0.66 0.613
Shiba: 0.80 0.71
Polygon: 0.70 0.642
Monero, Dogecoin, Litecoin: - 0.62
Average: 0.669
  
Zou and Herremans [46] Bitcoin: 0.643 0.546
  
Elgeldawi et al. [47] Bitcoin: 0.55 0.5
  
Amirshahi and Lahmiri [25] Bitcoin: 0.49
Ethereum: 0.501
Litecoin: 0.54
Average: 0.522
  • Note: The HBA model, which represents our proposed approach, demonstrates superior predictive accuracy compared to previous studies. The highest accuracy values for different cryptocurrencies indicate that our model performs better in most cases. Specifically, the HBA model achieves 0.80 for Shiba, 0.70 for Polygon, and 0.66 for AMP. The overall average accuracy for our approach is 0.669, which is higher than the averages reported in earlier studies. For comparison, Shintate and Pichl [45] achieved notable results, with an accuracy of 0.64 for Solana, 0.66 for Binance, and an overall average accuracy of 0.638. Kiran and Stannett [28] reported an accuracy of 0.62 for Litecoin and 0.67 for Ripple, with an overall average of 0.613. Meanwhile, Zou and Herremans [46] obtained an accuracy of 0.643 for Bitcoin, showing strong performance in Bitcoin prediction but lacking a broader cryptocurrency analysis. Other studies, such as studies by Elgeldawi et al. [47] and Amirshahi and Lahmiri [25], reported lower accuracy values, with averages of 0.505 and 0.522, respectively. These findings indicate weaker predictive performance than our model. Overall, these comparisons highlight the effectiveness of the HBA model, particularly in predicting Shiba, Polygon, and AMP, while achieving a higher average accuracy than previous works.

Kiran and Stannett [28] used CNN to predict cryptocurrency trends using technical analysis. In this study, they compared the performance of CNN with traditional multilayer perceptron (MLP) models, focusing on six major cryptocurrencies, Bitcoin, Dash, Ethereum, Litecoin, Monero, and Ripple, in the third quarter of 2018. The results showed that CNNs performed better than MLPs, especially for Bitcoin and Ethereum, and the prediction accuracy improved significantly. They concluded that technical indicators (TIs) play an essential role in improving the accuracy of price forecasts.

Shen, Urquhart, and Wang [21] employed machine learning algorithms, including logistic regression, SVM, random forest, and XGBoost, to predict Bitcoin, Ethereum, and Litecoin price trends. َThe authors used Bayesian models to help investors better understand the relationships between selected features and cryptocurrency price trends. The results indicated that random forest and logistic regression outperformed traditional trading strategies, yielding higher returns.

Singathala et al. [44] explore the use of the Fibonacci TI in conjunction with a hybrid CNN and LSTM model to predict profitability trends in cryptocurrency markets. The study uses multiclass classification techniques to improve the accuracy and depth of predictions by incorporating trend strength and direction into the model.

Saleem, Yaqub, and Zaman [48] introduced a framework to forecast Bitcoin price fluctuations using Twitter sentiment analysis. The study gathered over 3 million tweets from 2013 to 2022, using terms like “bitcoin” and “BTC,” and incorporated normalized positive and negative sentiment scores and variances to enhance the sentiment analysis model. Their findings show the strong impact of negative sentiments in driving Bitcoin price declines, highlighting the importance of real-time sentiment monitoring.

Shintate and Pichl [45] developed a trend prediction classification framework for high-frequency Bitcoin time series using deep learning techniques. They introduced the random sampling method (RSM), a novel approach to improve the prediction of Bitcoin price movements by addressing nonstationary data and class imbalance issues. The study compares the performance of the RSM with traditional methods such as LSTM and MLP, demonstrating that RSM outperforms these models in classification accuracy, recall, and F1-Score.

Zou and Herremans [46] proposed the PreBit multimodal model to predict extreme Bitcoin price movements by combining Twitter data, TIs, and correlated asset prices. The model uses FinBERT embeddings to capture the financial context of tweets and integrates them with candlestick data and various TIs in a hybrid framework involving SVM and CNN.

5. Discussion

This research is divided into two parts: sentiment analysis based on tweets and forecasting the price trend of cryptocurrencies. The HDBA hybrid model has been used for facet-based sentiment analysis. This model combines DistilBERT pretrained neural network, BiGRU deep neural network, and attention layer. The effectiveness of pretrained deep neural networks in facet-based sentiment analysis has been proven, especially when the dataset for training deep models in the target domain is sparse [49, 50].

Also, BiGRU, having two GRU layers connected inversely, can model and analyze the text or sentence in two directions. This feature is essential because sentiment analysis may contain content related to different aspects in different parts of the sentence or text, and we need to understand the relationship between them. In addition, in the HDBA model, the attention layer has been used to find essential situations in the text, which is consistent with the results of research [51] regarding the effect of the attention layer in increasing the efficiency of sentiment analysis models. As shown in the results of experimental tests, sentiment analysis of tweets and integration with historical prices is very effective in analyzing the price trend of cryptocurrencies. These results are consistent with the research results [52, 53]. However, in most research, the analysis of sentiments has been done traditionally, and the aspects of the text have not been paid attention to [12, 54]. Also, in most research, ready-made models such as VADER [54, 55] have been used for sentiment analysis. At the same time, models like VADER are made for general tweets and not fine-tuned for specialized texts. Also, these models cannot recognize aspects of tweets. Therefore, it can be concluded that using general models and even pretrained models that cannot recognize aspects or are not fine-tuned for specialized tweets, such as cryptocurrencies, leads to a decrease in the model’s efficiency in predicting the price trend of cryptocurrencies. In addition, in this research, unlike most articles [3, 6], that extract tweets about cryptocurrencies without considering the user’s expertise and merely relying on hashtags, this research utilized tweets from experts in the field. The use of tweets from people who do not have expertise in the field of cryptocurrencies can cause the model to deviate from the correct prediction of the cryptocurrency market trend. The importance of considering the authors’ expertise in this study is consistent with the results of previous studies [35, 37].

Another point considered in this research is the allocation of IC in each tweet. The same importance of not considering the tweets of different users is consistent with the results of the research of Otabek and Choi [56]. However, a normalized IC is assigned to each tweet in this research. Assigning IC to each tweet has the advantage that the value of the tweet is calculated based on the feedback of other users and reduces the importance of the number of followers of a particular user. Therefore, if a user’s tweet is valuable, it will get a higher IC regardless of the user’s number of followers. The importance of the influence of tweet popularity instead of considering the number of user followers has been proven in the research of Fang, Costas, and Wouters [57].

As mentioned, the HDBA model has been fine-tuned for facet-based sentiment analysis of cryptocurrency-related tweets. Two methods of training the model with cross-domain data and adjusting the parameters with grid search have been used to fine-tune this model. The use of cross-domain datasets causes the sensitivity of the learning model to decrease concerning the context of the text. So, the model is efficient in dealing with texts with different contexts. These findings are consistent with the results of previous studies [5860] regarding deep learning with cross-domain data. This use of the grid search method makes hyperparameters more accurately selected for the current application of the model, which improves the model’s efficiency. The use of grid search in improving the efficiency of deep learning models has been proven in [42, 47].

After sentiment analysis of the tweets, their integration with historical data has been used to analyze the price trends of eight cryptocurrencies. The HBA model predicts the price trend, combining BiGRU and the attention layer. The effectiveness of BiGRU in predicting the price trend of cryptocurrencies has been proven in previous studies [43, 44]. It has also been shown that the attention layer causes the relationships in the data and its essential features to be revealed, and the deep network can better understand these relationships [61]. The point considered in this research is the time frame of influence of the price trend of cryptocurrencies from Twitter sentiments and historical prices. This study considers the best time interval of price prediction as a hyperparameter. The results show that the sentiments of tweets with the addition of historical prices have the most significant impact on the eight cryptocurrencies examined on average after 3.75 days. This time frame is much less in Bitcoin because it is the market’s first and most secure cryptocurrency. Therefore, the existence of good or bad news can quickly attract the attention of investors to its transactions.

In general, the proposed method accurately detects the increase or decrease in the price trend of cryptocurrencies on average 67% of the time. This can be very beneficial for investors to choose an investment strategy and portfolio management.

6. Conclusion and Future Work

In this research, the HDBA + HBA model is presented to predict the price trend of eight cryptocurrencies based on historical prices and sentiments of cryptocurrency expert influencers on Twitter. The tweets of secret influencers are much more valuable than extracting tweets with hashtags in terms of importance and impact on the market. These tweets can give the model a better view of the market’s future. The HDBA model, which is a combination of DistilBERT, BiGRU, and the attention layer, has been used to analyze the sentiments of these tweets. The parameters of the DistilBERT model as the network’s backbone are trained with three cross-domain datasets for aspect-oriented sentiment analysis. Also, the attention layer has been used to detect more important situations in the text, and the BiGRU deep neural network has been used for two-way text processing. The HDBA model extracts all aspects and sentiments of cryptocurrency tweets and injects them into the HBA model for trend prediction. Instead of assigning a polarity to the entire tweet, the HDBA model assigns a polarity to each aspect (codes), which makes the efficiency of the model not decrease in dealing with tweets with several aspects. The F1-Score and accuracy evaluation criteria show that the HDBA model has improved the efficiency by 3% on the SemEval benchmark dataset. Also, the ROC-AUC chart shows that this model has identified all the polarities with proper accuracy, and its efficiency has not dropped significantly in the polarities with a meager data amount. In addition, the grid search method is used to select the hyperparameters of the HDBA model, which makes the model fine-tuned suitably with the task used.

The HBA model, a combination of the BiGRU neural network and the attention layer, has been used to predict the price trend of cryptocurrencies. In this model, the best time frame for detecting the impact of emotions by integrating historical prices on cryptocurrency trends is considered a superparameter. The results show that the period of the impact of Twitter emotions with the integration of historical price on the price trend of each cryptocurrency can be different; however, for the eight cryptocurrencies of this research, the period of the impact is 3.75 days on average. The HBA model has been able to predict the price trend of cryptocurrencies with an average precision of 0.73 and an accuracy of 0.68. This model suggests two time frames for each cryptocurrency as the best time to be influenced by market sentiments. The HBA model helps investors and cryptocurrency market participants discover new investment opportunities and better manage their stock portfolios. This model can reduce investment risk by understanding market behavior.

In future work, we will compare the effects of other social networks on cryptocurrency and find the most effective social network on market behavior. Also, in addition to the historical price, we add technical analysis indicators to the data and determine the characteristics of the best parameters in predicting the price trend of cryptocurrencies.

Conflicts of Interest

The authors declare no conflicts of interest.

Author Contributions

Kia Jahanbin contributed to conceptualizing and implementing transfer learning, sentiment analysis, writing–review, and trend prediction models and drafted the manuscript. Mohammad Ali Zare Chahooki contributed to administration, methodology, validation, and editing.

Funding

No fund was received.

Endnotes

1https://www.kaggle.com/datasets/gauravduttakiit/bitcoin-tweets-16m-tweets-with-sentiment-tagged.

Data Availability Statement

The datasets used or analyzed during the current study are available, and the following data were downloaded: bitcoin tweets—https://www.kaggle.com/datasets/gauravduttakiit/bitcoin-tweets-16m-tweets-with-sentiment-tagged; stopwords—https://github.com/ravikiranj/twitter-sentiment-analyzer/blob/master/data/feature_list/stopwords.txt; influencers’ tweets—https://data.mendeley.com/datasets/8fbdhh72gs/5.

    The full text of this article hosted at iucr.org is unavailable due to technical difficulties.