Bitcoin Trading Indicator A Machine Lear
Bitcoin Trading Indicator A Machine Lear
Ashikur Rahaman1, Abu Kowshir Bitto1,6, Khalid Been Md. Badruzzaman Biplob1, Md. Hasan Imam
Bijoy2, Nusrat Jahan3,4, Imran Mahmud1,5
1
Department of Software Engineering, Daffodil International University, Dhaka, Bangladesh
2
Department of Computer Science and Engineering, Daffodil International University, Dhaka, Bangladesh
3
Department of Information Technology and Management, Daffodil International University, Dhaka, Bangladesh
4
Department of Computer Engineering, University Malaysia Perlis, Arau, Malaysia
5
Graduate School of Business, Universiti Sains Malaysia, Penang, Malaysia
6
MediprospectsAI Limited, London, United Kingdom
Corresponding Author:
Abu Kowshir Bitto
Department of Software Engineering, Daffodil International University
Dhaka, Bangladesh
Email: [email protected]
1. INTRODUCTION
A person [1] going by the name of Satoshi Nakamoto originally published one of the finest
cryptocurrencies, bitcoin, on January 9, 2009. Each bitcoin was only worth $2.26 when the bitcoin to US
dollar (BTCUSD) pair first entered the currency market. The most volatile cryptocurrency now that demands
more general attention is bitcoin. Everyone, from researchers to traders, is searching for a pricing pattern to
invest in and make the biggest return they can. Bitcoin: a peer-to-peer (P2P) electronic cash system that was
introduced as a forward-thinking electronic cash alternative on just nine pages.
On the surface, cryptocurrencies like bitcoin [2] and others resemble fiat money a lot. As with
regular money, a bitcoin can be broken into smaller pieces known as Satoshi's and used to make purchases
from businesses that take bitcoin. To store bitcoins, a user must first build a wallet. On a computer or a
mobile device, this wallet can be downloaded and installed. Some websites also offer access to online
wallets, and some hardware vendors sell USB sticks that are actual wallet devices. These wallets come with a
bitcoin address that may be used to send or receive money. In technical terms, a bitcoin address is a hashed
representation of a public key. The corresponding private key is retained in the wallet and is encrypted and
secret [3]. The foundation of the entire bitcoin network is the blockchain, a decentralised public ledger. It
records all previous exchanges between various bitcoin addresses, including the amounts sent. This makes it
possible to determine how much money is available in each wallet. It also enables the ownership of the spent
bitcoins to be confirmed. The integrity and chronological order of the blockchain are guaranteed by
cryptography [3].
All transactions are published to the P2P network through mining [4]. Miners put a lot of time and
effort into creating hashes that meet certain criteria. The process of adding new bitcoins to circulation is
known as bitcoin mining. By resolving incredibly difficult math puzzles, new bitcoins are created through the
process of mining, which also verifies bitcoin transactions. When a bitcoin is successfully mined, the miner is
given a certain number of bitcoins.
A decentralised or over-the-counter (OTC) market for trading foreign currencies is known as the
foreign exchange market (forex, FX, or currency market) [5]. The foreign exchange rate for each currency is
set by this market. It includes all transactions involving the buying, selling, and exchanging of currencies at
set or prevailing rates. "Percentage in point" or "price interest point" is abbreviated as pip [6]. In the foreign
exchange market, it is a tiny unit of measurement that denotes a change in a currency pair. Either the stated
currency or the underlying currency may be used to represent it as a percentage. The smallest alteration in a
currency quote is represented by a standardised unit called a pip. A lot [7] is a predetermined sum of money
used along with pips to execute a trade in forex. Fortunately, a range of lot sizes are available to traders.
Typically, in order to take a deal, traders must choose the lot size. On a normal trading account for excess,
lots start at 0.0001 and can reach a maximum of 5. By putting more money into various accounts, you can
raise the size of your lots.
Natural language processing (NLP) is used in sentiment analysis [8], [9] to determine if data is
favourable, negative, or neutral. Organizations typically employ sentiment analysis on textual data to analyse
brand and product sentiment in consumer feedback and gain a better understanding of client wants. To
evaluate and derive objective quantitative findings from unprocessed text, sentiment analysis uses NLP
machine learning and other data analysis approaches. Sentiment analysis is a branch of text mining.
In 1998, one of the earliest books on stock market forecasting [10] was published. Information was
acquired by Wüthrich and associates from the Wall Street Journal, Financial Times, Reuters, and Bloomberg.
According to Borges [11] any positive or negative news is immediately absorbed by the market, and stock
prices change in accordance. Therefore, it is impossible to outperform the stock market because there are
never any undervalued stocks to buy or overvalued stocks to sell. Over extended periods, many investors,
including Warren Buffet, have been able to outperform the market. A single-layered convolutional neural
network (CNN) model was created by Cavalli and Amoretti [12] to increase earnings when the trend is
bullish and decrease losses when the market is bearish. Their creations were based on text from several social
media profiles. A trading strategy test revealed that it had superior accuracy and return compared to a single
source system [13]. An recurrent neural network (RNN)-based model was employed in a depth literature
analysis [14] to forecast the price of bitcoin based on Twitter sentiment. By using analysis, we can predict the
price of bitcoin based on the emotion of tweets that come from specific sources. I particularly like how they
use gradient descent, another machine-learning method, to extract a significant price from Twitter sentiment
analysis by using daily high and low prices from historical data. A number of machine learning techniques
are detailed in the reference paper by Colianni et al. [15] that predict the price of bitcoin. Before using their
model, they even conducted extensive literature research. They used two datasets to distribute their model.
One was for hourly data followed by time series, and the other was for daily time series data. Additionally,
they used supervised learning to classify Twitter sentiment using data from Twitter. The accuracy and
maximum result they were able to achieve using Bayesian Naive Bayes was 95% for day-basis data and
76.59% for hour-basis data. Research by Garcia and Schweitzer [16] published a companion piece. The
researchers used a trading simulation engine and two daily Twitter sentiment time series. The latter was
based on a collection of positive and negative terms from the linguistic inquiry and word count (LIWC)
lexicon, as well as the daily ratio between them.
To trade in forex, we must do a market analysis, determine the present stance of the market pair, and
make a prognosis or projection. It is difficult for one person to consider every angle because humans make
mistakes, and doing so has so far taken a lot of time. Additionally, because of how quickly time passes,
traders must act more quickly while making decisions. Therefore, our goal is to create a real-time "bitcoin"
trading indicator for the currency market that is powered by machine learning. To be more precise, we want
to predict whether we should "buy" or "sell" on the following day. We'll employ current market support and
resistance in real-time to work toward this objective. We won't purchase actual bitcoin. But we'll deal in
Bitcoin trading indicator: a machine learning driven real time bitcoin trading … (Ashikur Rahaman)
1764 ISSN: 2302-9285
bitcoin on the foreign exchange market. The tone of the tweet from the day before is the main focus. In order
to see the market trend and do a seasonal study, we also create a time series forecasting model.
2. RESEARCH METHOD
In this segment, data collection, web scraping, data handling/pre-processing, time series generation,
data analysis with forecasting, and developing BTI trading indicator has complied, which represent in
Figure 1; the details explanation is given orderly.
Bulletin of Electr Eng & Inf, Vol. 12, No. 3, June 2023: 1762-1772
Bulletin of Electr Eng & Inf ISSN: 2302-9285 1765
Bitcoin trading indicator: a machine learning driven real time bitcoin trading … (Ashikur Rahaman)
1766 ISSN: 2302-9285
tweet. This is because, when performing our operation that will produce more realistic outcomes when it
comes to conducting Forex or stock market trading, we require the total number of tweets. The movement of
a currency like Bitcoin on the FX market is correlated with public opinion. Therefore, if a trader can in some
way comprehend the current mood, they can in some way comprehend market tendencies to execute their
transaction.
The sentiment polarity of the element, which decides whether the text conveys the user's positive,
negative, or neutral feeling about the subject, defines the orientation of the stated emotion, which is between
[-1,1]. Subjectivity [24] exists between [0, 1]. Subjectivity is a metric used to determine how much of a text
is made up of fact and personal opinion. The text is more subjective than usual; therefore, it offers personal
opinions rather than objective information. We can begin writing the function to create a Sentiment class
once we have determined the subjectivity and polarity of a data collection. I utilised the sentiment classes
positive, negative, and neutral in this instance. Polarity is defined as "positive" if it is greater than 0 and
"negative" if it is less than 0. Sometimes it might be 0, in which case the sentiment class will be displayed as
"neutral". For our tool, this sentiment class is crucial. since judgements made by the computer will be based
on this class. The entire algorithm could deliver incorrect information if our sentiment analysis is flawed. If
that occurs, we might suffer a large financial loss.
We can filter tweets about subjectivity to get some more ordinal results. The outcome might be more
appealing if we filter away tweets with more subjectivity. Table 4 details the Sentiment class and the filtered
tweets dataset.
FBProphet utilises a linear model to match the data, but by adjusting its parameters, it can convert to
a nonlinear model (logistics growth). By default, FBProphet fits our model into a linear model. Some things
will be fully realised as prediction technology advances. Carrying capacity is what it is known as, and the
anticipated increase should reach it. Time-series forecasting is the process of building a model to forecast
future values based on recent and historical time-series data.
Therefore, the first thing we must do is to get the data. The Prophet demands that we change the
name of the "date" column to "ds" and that we call our y-column just "y." Although Prophet does most of its
work in the background, there are a few hyperparameters that let us easily adjust our models. To work with
FB-Prophet in this instance, i used the "date" column as "ds" and the "close" column as "y". The intended
data set's head portion is depicted in Figure 4(a).
Once the data has been generated, we can now use Prophet's forecast method to obtain other
forecasted variables. Figure 4(b) shows "yhat," which is the anticipated closing price, "yhat lower," which
stands for the day's support, and "yhat upper," which stands for the day's resistance. The "ds" column,
specifically, represents the future date.
Bulletin of Electr Eng & Inf, Vol. 12, No. 3, June 2023: 1762-1772
Bulletin of Electr Eng & Inf ISSN: 2302-9285 1767
(a) (b)
Figure 4. Data (a) preparation for FBProphet and (b) forecast data using FBProphet
Here, n denotes the number of errors, |𝑥𝑖 − 𝑥| the absolute errors, and the summation sign (it means
to add all). The MSE of the estimator determines the average squared error in statistics. The true value and
the estimated value are contrasted using the average squared. It demonstrates how close a regression line
must be to a group of points. The distance from the regression line point demonstrates this, followed by a
square. All of the negative value is turned positive by this square. We determine the square of error using
MSE. "(3)" is the formula for MSE.
1
𝑀𝑆𝐸 = ∑𝑛𝑖=1 |𝐴𝑐𝑡𝑢𝑎𝑙 − 𝑓𝑜𝑟𝑐𝑎𝑠𝑡|2 (3)
𝑛
Here, n is the number of elements, is the sum, actual is the original y-value, and forecast is the
regression y-value. The RMSE stands for the standard deviation of prediction error. We can determine the
locations of the data points on the regression line using residuals or prediction error. The RMSE method
determines how large these prediction mistakes are. It demonstrates how closely the data are related to the
best fitting line. RMSE is typically used in climatology, regression analysis, and forecasting to validate
experimental results. "(4)" is the formula for RMSE.
1
𝑅𝑀𝑆𝐸 = √ ∑𝑛𝑖=1 |𝑠𝑖 − 𝑜𝑖 |2 (4)
𝑛
Here, oi =observations, si =variables predicted values, n=Observations number for analysis which
is available.
Bitcoin trading indicator: a machine learning driven real time bitcoin trading … (Ashikur Rahaman)
1768 ISSN: 2302-9285
Bulletin of Electr Eng & Inf, Vol. 12, No. 3, June 2023: 1762-1772
Bulletin of Electr Eng & Inf ISSN: 2302-9285 1769
Table 6 demonstrates that the combined model's profitability is the highest. That implies that
bitcoin's price movement is not only dependent on a single element; rather, there are a number of additional
factors that might influence the market's direction. The first model only generates tweets and examines
sentiment analysis of tweets using #bitcoin to see if it produces output in three categories. which are polar
opposites, positive, and neutral. Although we can make some money there, it is insufficient for professional
trading. Time series forecasting with FBProphet can provide market trends and other time series forecasting
details, however employing this method exclusively would not be a suitable strategy because there are very
few shortcomings in it.
Bitcoin trading indicator: a machine learning driven real time bitcoin trading … (Ashikur Rahaman)
1770 ISSN: 2302-9285
4. CONCLUSION
We demonstrated that price movement can be predicted by the overall mood analysis. To
accomplish our main objective, we added up all subjective polarity and divided it by the size of the data
frame to maintain a polarity between -1 and +1. The final step of this analysis is a function that determines
our options. In order to achieve our goal, we evaluated our model by combining it with other variables. In
order to provide more details about the BTCUSD market, we generally gathered certain site material and
extracted historical pricing data. Additionally, when needed, our model is able to detect and retrieve the
current date. The study's most important finding was that we were able to profit by $1,000.71 USD in just 10
days with little error (RMSE: 1480.58) using the combined version of the programme. At a glance, we can
state that Twitter sentiment analysis can provide sentiment towards the state of the market, and other data can
provide entry and exit points for a certain trade.
REFERENCES
[1] S. Nakamoto, “Bitcoin: A peer-to-peer electronic cash system,” Decentralized Business Review. pp. 1–9, 2008.
[2] R. Böhme, N. Christin, B. Edelman, and T. Moore, “Bitcoin: Economics, technology, and governance,” Journal of Economic
Perspectives, vol. 29, no. 2, pp. 213–238, May 2015, doi: 10.1257/jep.29.2.213.
[3] H. Vranken, "Sustainability of bitcoin and blockchains," Current opinion in environmental sustainability, vol. 28, pp. 1-9, 2017,
doi: 10.1016/j.cosust.2017.04.011.
[4] R. Böhme, N. Christin, B. Edelman, and T. Moore, "Bitcoin: Economics, technology, and governance," Journal of economic
Perspectives, vol. 29, no. 2, pp. 213-238, 2015, doi: 10.1257/jep.29.2.213.
[5] M. D. D. Evans, "Forex trading and the WMR fix," Journal of Banking & Finance, vol. 87, pp. 233-247, 2018, doi:
10.1016/j.jbankfin.2017.09.017.
[6] A. Hayes, “What are Pips in Forex trading and what is their value?,” Investopedia, 2022.
https://www.investopedia.com/terms/p/pip.asp (accessed May 11, 2022).
[7] J. Chen, “What is standard lot? definition in Forex and calculating lots,” Investopedia, 2020.
https://www.investopedia.com/terms/s/standard-lot.asp (accessed May 11, 2022).
[8] S. Gupta, “Sentiment analysis: Concept, analysis and applications,” Towards data science, 2018.
https://towardsdatascience.com/sentiment-analysis-concept-analysis-and-applications-6c94d6f58c17 (accessed May 12, 2022).
[9] R. J. Lia, A. B. Siddikk, F. Muntasir, S. S. M. M. Rahman, and N. Jahan, “Depression detection from social media using Twitter’s
tweet,” in Big Data Intelligence for Smart Applications, 2022, pp. 209–226, doi: 10.1007/978-3-030-87954-9_9.
[10] B. Wuthrich, V. Cho, S. Leung, D. Permunetilleke, K. Sankaran, and J. Zhang, “Daily stock market forecast from textual web
data,” in SMC’98 Conference Proceedings. 1998 IEEE International Conference on Systems, Man, and Cybernetics (Cat.
No.98CH36218), 1998, pp. 2720–2725, doi: 10.1109/ICSMC.1998.725072.
[11] M. R. Borges, “Efficient market hypothesis in European stock markets,” The European Journal of Finance, vol. 16, no. 7, pp.
711–726, Oct. 2010, doi: 10.1080/1351847X.2010.495477.
Bulletin of Electr Eng & Inf, Vol. 12, No. 3, June 2023: 1762-1772
Bulletin of Electr Eng & Inf ISSN: 2302-9285 1771
[12] S. Cavalli and M. Amoretti, “CNN-based multivariate data analysis for bitcoin trend prediction,” Applied Soft Computing, vol.
101, pp. 1–13, Mar. 2021, doi: 10.1016/j.asoc.2020.107065.
[13] Y. Zhai, A. Hsu, and S. K. Halgamuge, “Combining news and technical indicators in daily stock price trends prediction,” in
International Symposium on Neural Networks, 2007, pp. 1087–1096, doi: 10.1007/978-3-540-72395-0_132.
[14] D. R. Pant, P. Neupane, A. Poudel, A. K. Pokhrel, and B. K. Lama, “Recurrent neural network based Bitcoin price prediction by
Twitter sentiment analysis,” in 2018 IEEE 3rd International Conference on Computing, Communication and Security (ICCCS),
Oct. 2018, pp. 128–132, doi: 10.1109/CCCS.2018.8586824.
[15] S. Colianni, S. Rosales, and M. Signorotti, “Algorithmic trading of cryptocurrency based on Twitter sentiment analysis,” CS229
Project, vol. 1, no. 5, pp. 1–5, 2015.
[16] D. Garcia and F. Schweitzer, “Social signals and algorithmic trading of Bitcoin,” Royal Society Open Science, vol. 2, no. 9, pp. 1–
13, Sep. 2015, doi: 10.1098/rsos.150288.
[17] A. K. Bitto and I. Mahmud, “Multi categorical of common eye disease detect using convolutional neural network: a transfer learning
approach,” Bulletin of Electrical Engineering and Informatics, vol. 11, no. 4, pp. 2378–2387, Aug. 2022, doi: 10.11591/eei.v11i4.3834.
[18] J. Abraham, D. Higdon, and J. Nelson, “Cryptocurrency price prediction using tweet volumes and sentiment analysis,” SMU Data
Science Review, vol. 1, no. 3, pp. 1–21, 2018.
[19] K. S. Madhu, B. C. Reddy, C. Damarukanadhan, M. Polireddy, and N. Ravinder, “Real time sentimental analysis on Twitter,” in
2021 6th International Conference on Inventive Computation Technologies (ICICT), Jan. 2021, pp. 1030–1034, doi:
10.1109/ICICT50816.2021.9358772.
[20] A. K. Bitto et al., “CryptoAR: scrutinizing the trend and market of cryptocurrency using machine learning approach on time series
data,” Indonesian Journal of Electrical Engineering and Computer Science, vol. 28, no. 3, pp. 1684–1696, Dec. 2022, doi:
10.11591/ijeecs.v28.i3.pp1684-1696.
[21] K. Makice, Twitter API: Up and running: Learn how to build applications with the Twitter API. Sebastopol: "O’Reilly Media, Inc, 2009.
[22] B. S. Shekhawat, “Sentiment classification of current public opinion on BREXIT: Naïve Bayes classifier model vs Python’s
TextBlob approach,” M.S. thesis, Dept. Sci. in Data Analytics, National College of Ireland, Dublin, Ireland, 2019.
[23] S. Rahman, N. Jahan, F. Sadia, and I. Mahmud, “Social crisis detection using Twitter based text mining-a machine learning approach,”
Bulletin of Electrical Engineering and Informatics, vol. 12, no. 2, pp. 1069–1077, Apr. 2023, doi: 10.11591/eei.v12i2.3957.
[24] A. Szabolcsi, “Positive polarity–negative polarity,” Natural Language & Linguistic Theory, vol. 22, no. 2, pp. 409–452, May
2004, doi: 10.1023/B:NALA.0000015791.00288.43.
[25] R. K. Jana, I. Ghosh, and M. W. Wallin, “Taming energy and electronic waste generation in bitcoin mining: Insights from
Facebook prophet and deep neural network,” Technological Forecasting and Social Change, vol. 178, p. 121584, May 2022, doi:
10.1016/j.techfore.2022.121584.
[26] M. A. Rubi, H. I. Bijoy, and A. K. Bitto, “Life expectancy prediction based on GDP and population size of Bangladesh using
multiple linear regression and ANN model,” in 2021 12th International Conference on Computing Communication and
Networking Technologies (ICCCNT), Jul. 2021, pp. 1–6, doi: 10.1109/ICCCNT51525.2021.9579594.
BIOGRAPHIES OF AUTHORS
Khalid Been Md. Badruzzaman Biplob pursued his bachelor's degree and
Master of Science in Computer Science and Engineering (CSE) at Daffodil International
University (DIU), Dhaka, Bangladesh. Currently he is working as a Senior Lecturer in
Software Engineering department at DIU. He is doing his Ph.D in Education from
University Sains Islam, Malaysia. His area of interest includes machine learning, deep
learning, and educational research. He can be contacted at email:
[email protected].
Bitcoin trading indicator: a machine learning driven real time bitcoin trading … (Ashikur Rahaman)
1772 ISSN: 2302-9285
Md. Hasan Imam Bijoy pursued his bachelor's degree (B. Sc) in Computer
Science and Engineering (CSE) at Daffodil International University (DIU), Dhaka,
Bangladesh. Currently he is working as a Lecturer in CSE department at DIU. He is a
Convener of the Virtual Multidisciplinary Research Lab. He is a research zealot, having
published over 15 conference papers, 4 journal publications, and one programming book (A
Handbook of C Programming with Example). His area of interest includes machine
learning, deep learning, computer vision, natural language processing, image processing,
internet of things, and so many field. He can be contacted at email: hasan15-
[email protected].
Bulletin of Electr Eng & Inf, Vol. 12, No. 3, June 2023: 1762-1772