Научная статья на тему 'ON METHODS OF BUILDING THE TRADING STRATEGIES IN THE CRYPTOCURRENCY MARKETS'

ON METHODS OF BUILDING THE TRADING STRATEGIES IN THE CRYPTOCURRENCY MARKETS Текст научной статьи по специальности «Экономика и бизнес»

CC BY
194
30
i Надоели баннеры? Вы всегда можете отключить рекламу.
Ключевые слова
BITCOIN / TRADING STRATEGY / ENSEMBLE MODELS / DEEP LEARNING

Аннотация научной статьи по экономике и бизнесу, автор научной работы — Shchetinin Eugeny Yu.

The paper proposes a trading strategy for investing in the cryptocurrency market that uses instant market entries based on additional sources of information in the form of a developed dataset. The task of predicting the moment of entering the market is formulated as the task of classifying the trend in the value of cryptocurrencies. To solve it, ensemble models and deep neural networks were used in the present paper, which made it possible to obtain a forecast with high accuracy. Computer analysis of various investment strategies has shown a significant advantage of the proposed investment model over traditional machine learning methods.

i Надоели баннеры? Вы всегда можете отключить рекламу.
iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.
i Надоели баннеры? Вы всегда можете отключить рекламу.

Текст научной работы на тему «ON METHODS OF BUILDING THE TRADING STRATEGIES IN THE CRYPTOCURRENCY MARKETS»

Discrete & Continuous Models & Applied Computational Science 2022, 30 (1) 79-87

ISSN 2658-7149 (online), 2658-4670 (print) http://journals-rudn-ru/miph

Research article

UDC 519.6 PACS 07.05.Tp,

DOI: 10.22363/2658-4670-2022-30-1-79-87

On methods of building the trading strategies in the cryptocurrency markets

Eugeny Yu. Shchetinin

Financial University under the Government of Russian Federation 49, Leningradsky Prospect, Moscow, 125993, Russian Federation

(received: November 26, 2021; revised: January 18, 2022; accepted: February 18, 2022)

Abstract. The paper proposes a trading strategy for investing in the cryptocurrency market that uses instant market entries based on additional sources of information in the form of a developed dataset. The task of predicting the moment of entering the market is formulated as the task of classifying the trend in the value of cryptocurren-cies. To solve it, ensemble models and deep neural networks were used in the present paper, which made it possible to obtain a forecast with high accuracy. Computer analysis of various investment strategies has shown a significant advantage of the proposed investment model over traditional machine learning methods.

Key words and phrases: bitcoin, trading strategy, ensemble models, deep learning

1. Introduction

The development of the financial market for cryptocurrencies in 2021 has become one of the key trends in global capital. The COVID-19 pandemic, which began in 2020, only accelerated this process, as it caused a drop in traditional markets, forcing investors to look for alternative tools and products [1]. For many, the financial market for cryptocurrencies has become such a solution. This paper studies the investor's trading strategies in the cryptocurrency market and analyzes their effectiveness in comparison with the classical financial asset market. Their feature is the high volatility of the cryptocurrency market, so it would be natural to apply portfolio formation strategies to change the asset trend. Under these conditions, investors usually use strategies that allow them to open a position at the initial stage of a trend formation. Thus, the main goal of the work is to develop a computer system for detecting the moment of entering the cryptocurrency market and testing its effectiveness using the example of bitcoin.

© Shchetinin E.Y., 2022

This work is licensed under a Creative Commons Attribution 4.0 International License http://creativecommons.org/licenses/by/4-0/

2. Methods for modeling and forecasting the value

of cryptocurrencies

Methods for modeling and forecasting prices for financial assets can be divided into methods of technical and fundamental analysis, which determine the characteristics and form the value of an asset and features of its behavior. The first approach is based on the laws of probability theory and mathematical statistics, which allow solving various problems with different qualitative characteristics using universal methods [2]. As a rule, the first approach assumes a fundamental theory that is well formalized, understandable and logical. However, its working conditions are 'ideal' and its application in practice does not always make it possible to make a reliable prediction. The second approach aims to test complex mathematical methods and tools to solve the first one. At the same time, methods of regression, variance, and correlation analyzes are widely used. They allow understanding the interdependencies between the asset in question and other factors. However, these methods poorly predict asset dynamics.

Since the value of an asset is measured over time, it can be analyzed using econometric time series methods. However, this requires the condition of stationarity and linearity, which are not present in the real asset market. To solve this problem, the change or profitability of the asset is considered rather than its value. The use of various econometric models in trading strategies is justified in the short term, but in the long term, this approach is extremely risky due to high volatility [3], [4]. Recently, machine learning methods have become widely used for trading in financial markets due to their ability to build effective dynamic forecasting models. They solve a wide range of problems: regression, classification, clustering. Moreover, these methods show themselves best in solving such problems.

We will use the following investor strategy to generate revenue in the cryptocurrency market:

where yt is the trend label, CSMA is the centered moving average, BBW is the Bollinger band with the superscript for upper and lower one. The use of CSMA is due to the fact that the characteristics to be used have significant predictive power. In this paper, the dominant cryptocurrency bitcoin was chosen, for which there is also a large amount of information. It is possible to single out the data sources from where the information will be taken [3]:

— market;

— fundamental;

— alternative.

For more accurate forecasts, it was decided to create a complex dataset that consists of all the types of data sources listed above. In the market data, the prices and trading volumes of Bitcoin itself, VIX and gold were selected. VIX is an index of fear, which is calculated based on supply and demand for option contracts, which reflects expectations for such a popular index as the S&P

0, CSMAW (t) < BB^ (t) - downward,

1, BBd°wn(t) < CSMAW (t) < BBUJ (t) - flat, .2, CSMAW(t) > (t) - upward,

w

(1)

500 [3]. If the indicator exceeds the 40-point mark, then it is considered that panic begins in the classic markets. It is at times like these that investors try to find alternative investments, which include Bitcoin. Gold is also considered to be an asset that people begin to actively invest in during the crisis. The data was obtained through the yahoo finance API. The information field also greatly influenced the value of bitcoin and cryptocurrencies [2]. The names in the table correspond to the queries. Fundamental factors directly represent the value of an asset. The information was taken from the blockchain.info website using the API. Market indicators that were obtained using the TA-Lib library helped to assess the 'pulse' of the market and understand which trading patterns are applied at the current time. The data were scaled and then their daily increments were calculated, taking into account their balance by class. A general description of the data can be seen in the table 1.

3. Selection of optimal model parameters and forecasting

After solving the problem of creating a dataset, it is necessary to choose a computer model that will allow us to build an optimal forecast for the value of bitcoin. Machine learning provides a large number of classification models. For example, the following ensemble models are especially popular [5]:

— Random forest;

— Ada boost;

— Light GBM;

— XG Boost.

In addition, to classify the trend at the time of entering the market, a recurrent neural network with a long short-term memory (LSTM) cell was used [6]. The described dataset is preliminarily divided into a training set and a test set. Their distribution can be seen in the figure 1.

Upward Flat Downward

■ Training Test

Figure 1. Distribution of the training and test sample over trend labels

Table 1

Description of the dataset and the factors it contains

Market — btc vol - bitcoin open — Open - Bitcoin opening price — Vix - VIX index opening — Gold - gold opening price — Gold vol - gold trading volumes

Alternative — Bitcoin - Google popularity index for the query 'bitcoin' — bitcoin wallet - Google popularity index for the query 'bitcoin wallet' — buy bitcoin - Google popularity index for the query 'buy bitcoin' — sell bitcoin - Google popularity index for the query 'sell bitcoin' — Blockchain - Google popularity index for the query 'bitcoin wallet'

Fundamental — tr per block - transactions in the block — tr cost - transaction cost — Miners rev - miners' revenue — N unique addresses - number of unique addresses — NVT is a metric calculated by dividing the network value by the total volume of transactions in USD in 24 hours. — NVTS - the same as NVT, the difference in the denominator of which is the moving average over the last 90 days

Market (indicators) — Willr sig - Williams indicator signal

Market — Willr sig - Stoch sig - Stochastic indicator signal — Mfi sig - cash flow indicator signal — Rsi sig - relative strength indicator signal

After training the models using the training set, predictions were made with the test set. We chose the accuracy indicator as the quality metric of the estimates obtained. As seen from the table 2, the gradient boosting of the Light GBM library turned out to be the best model [5]. The most important features were technical indicators and market data: 6 indicators out of 8 main ones. Fundamentals of NVT and NVTS also contributed. In terms of importance, these two indicators are equated to P/E for the stock market [7].

To further model the behavior of an investor using the strategy described above, we have chosen the Light GBM model.

Table 2

The accuracy of the forecast for the test sample

Model Accuracy, %

Random forest 68

Ada boost 69

Light GBM 70.4

XG Boost 70.28

LSTM 68

Figure 2. Distribution of data set factors according to the strength of their impact

on the forecast

Further, to test the selected Light GBM algorithm and select the optimal values of its parameters, backtesting was performed, i.e., a financial analysis procedure that allows you to tune the model to the current data stream. In the classic version, this is performed on ready-made data, however, existing solutions impose restrictions on the implementation of the project, therefore, a backtest was developed, which made it possible to simulate the dynamics of a portfolio that is built according to the strategy principle. The proposed backtesting algorithm takes into account the cost at which the asset, account, commission, credit when opening a short position and the flag of the possibility of opening a short position will be bought or sold. The following variables are specified in the backtest:

— Investment amount equal to $ 10,000;

— Credit 0.1%;

— Commission 0.09%;

— The purchase price is the closing price.

Actions of buying or selling are presented in the table 3.

Table 3

Actions of the portfolio management strategy

Signal ^sig ^sig 1 Action

Flat (lateral movement) 0 0 keep short

Flat 1 1 we keep funds in foreign currency

Flat 2 2 hold a long position

Upward 2 1 open a long position

Downward 0 1 open a short position

Flat 1 2 close a long position

Downward 0 2 close long, open short

Flat 1 0 close a short position

Upward 2 0 close short, open long

The dynamics of the value of the bitcoin portfolio is shown in the figure 3. The portfolio worked in unstable conditions throughout 1.11.2019-01.01.2021. It can also be noted that a portfolio with short positions wins and loses equally well to a less aggressive portfolio. However, when the price goes out of the sideways, the model starts to be profitable. Forecasts and quotation of the cost of bitcoin for the period 11.2019-01.2020 are shown in the Figure 4.

1B000 16000 14000 12000 10000 sooo

Portfolio

Figure 3. Dynamics of the portfolio value with and without short positions

2019-11 2020-01 2020-03 2020-05 2020-07 2020-09 2020-11 2021-01

2019-11 2020-01 2020-03 2020-05 2020-07 2020-09 2020-11 2021-01

Figure 4. Bitcoin Quote and Forecast Labels

The table 4 shows the results of evaluating the profitability of built portfolios with and without short positions, as well as the S&P 500 index. As seen from the table, an investor using the proposed strategy would have been able to earn 80% of the profit, whereas if he invested in the S&P 500 for the tested period, he would have earned only 24%.

Table 4

Model backtesting results

Portfolio model Profitability

short portfolio 81.43 %

no short portfolio 82.23 %

S&P 500 index 24.28 %

4. Discussion of results and conclusions

This paper proposes an original trading strategy for investing in cryptocur-rencies using the example of bitcoin. Its main properties and advantages are the ability to classify the current state of the trend and form a possible opening or closing a position for an asset or their portfolio. For the computer implementation of the proposed strategy, a machine learning model was developed based on the Light GBM model. To test the effectiveness of the formulated characteristics of the model, a synthetic dataset was developed based on the most important features extracted from market factors. Model testing and comparative analysis of the results obtained with other models showed a high degree of stability and accuracy of the proposed strategy. The proposed approach is universal and, therefore, it can be applied in various financial markets with high volatility.

References

[1] E. Y. Shchetinin, "Study of the impact of the COVID-19 pandemic on international air transportation," Discrete and Continuous Models and Applied Computational Science, vol. 29, no. 1, pp. 22-35, 2021. DOI: 10.22363/2658-4670-2021-29-1-22-35.

[2] E. Y. Shchetinin, Y. G. Prudnikov, and P. N. Markov, "Long range memory modeling and estimation for financial time series," RUDN Journal of Mathematics, Information Sciences and Physics, no. 1, pp. 98106, 2011, in Russian.

[3] J. Spörer, "Backtesting of algorithmic cryptocurrency trading strategies," Available at SSRN, 2020. DOI: 10.2139/ssrn.3620154.

[4] A. Y. Mikhailov, "Cryptoassets pricing and equity indices correlation," Finance and Credit, vol. 24, no. 3, pp. 641-651, 2018, in Russian. DOI: 10.24891/fc.24.3.641.

[5] A. Geron, Hands-on machine learning with Scikit-Learn, Keras, and TensorFlow: concepts, tools, and techniques to build intelligent systems, 2nd Edition. O'Reilly Media, Inc., 2019.

[6] G. G. Ognev and E. Y. Shchetinin, "Deep neural networks with LSTM architecture for predicting financial time series," in Information and Telecommunication Technologies and Mathematical Modeling of High-Tech Systems 2020 (ITTMM 2020), in Russian, Moscow, Russia, April 13-17, 2020, pp. 280-283.

[7] A. Arratia and A. X. Lopez-Barrantes, "Do Google trends forecast bitcoins? Stylized facts and statistical evidence," Journal of Banking and Financial Technology, vol. 5, no. 1, pp. 45-57, 2021.

iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.

For citation:

E. Y. Shchetinin, On methods of building the trading strategies in the cryp-tocurrency markets, Discrete and Continuous Models and Applied Computational Science 30 (1) (2022) 79-87. DOI: 10.22363/2658-4670-202230-1-79-87.

Information about the authors:

Shchetinin, Eugeny Yu. — Doctor of Physical and Mathematical Sciences, Lecturer of Department of Mathematics, Financial University under the Government of Russian Federation (e-mail: riviera-molto@mail.ru, ORCID: https://orcid.org/0000-0003-3651-7629)

УДК 519.6 PACS 07.05.Tp,

DOI: 10.22363/2658-4670-2022-30-1-79-87

О методах построения торговых стратегий на криптовалютных рынках

Е. Ю. Щетинин

Финансовый университет при Правительстве Российской Федерации Ленинградский проспект, д. 49, Москва, 125993, Россия

Аннотация. В работе предлагается торговая стратегия инвестирования в рынок криптовалют, использующая мгновенные входы на рынок на основе дополнительных источников информации в виде разработанного набора данных. Задача прогнозирования момента входа на рынок формулируется как задача классификации тренда стоимости криптовалют. Для её решения в статье использовались ансамблевые модели и глубокие нейронные сети, что позволило получить прогноз с высокой точностью. Компьютерный анализ различных инвестиционных стратегий показал значительное преимущество предложенной модели инвестирования перед традиционными методами машинного обучения.

Ключевые слова: биткойн, торговая стратегия, ансамблевые модели, глубокое обучение

i Надоели баннеры? Вы всегда можете отключить рекламу.