# Gold and Bitcoin Optimal Portfolio Research and Analysis Based on Machine-Learning Methods

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

- Based on the historical pricing data of gold and bitcoin, to establish a price fluctuation prediction model for both;
- Establishment of a model for effective evaluation of the portfolio strategies;
- Based on the investment portfolio model of the financial industry, this paper studies the relationship between bitcoin and gold, puts forward investment suggestions for maximizing benefits and conducts a sensitivity analysis of the scheme to put forward reasonable suggestions for improvement.

## 2. Assumptions and Justifications

**Assumption 1.**

**Justification:**

**Assumption 2.**

**Justification:**

**Assumption 3.**

**Justification:**

**Assumption 4.**

**Justification:**

## 3. Notations

## 4. Model Preparation

## 5. Model I: Linear Regression Prediction Model

#### 5.1. Data Preprocessing

#### 5.2. Data Segmentation

#### 5.3. Linear Regression Model (LRM)

#### 5.3.1. Regression to the Problem

#### 5.3.2. Linear Regression Model Description

## 6. Model II: K-Nearest Neighbor Algorithm

#### 6.1. KNN Algorithm Application

#### 6.1.1. Selecting the Appropriate K-Value

#### 6.1.2. Obtaining the Results

#### 6.2. Score Function to Determine Portfolio

## 7. Results

#### 7.1. Forecast Results

#### 7.2. Test of Goodness of Fit

#### 7.3. Price Change Weights Determine the Optimal Strategy

## 8. Discussion

## 9. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Acknowledgments

## Conflicts of Interest

## References

- Ciaian, P.; Rajcaniova, M.; Kancs, D.A. The economics of BitCoin price formation. Appl. Econ.
**2016**, 48, 1799–1815. [Google Scholar] [CrossRef] [Green Version] - Munim, Z.H.; Shakil, M.H.; Alon, I. Next-day bitcoin price forecast. J. Risk Financ. Manag.
**2019**, 12, 103. [Google Scholar] [CrossRef] [Green Version] - Hayes, A.S. Bitcoin price and its marginal cost of production: Support for a fundamental value. Appl. Econ. Lett.
**2019**, 26, 554–560. [Google Scholar] [CrossRef] [Green Version] - Greaves, A.; Au, B. Using the bitcoin transaction graph to predict the price of bitcoin. No Data
**2015**, 8, 416–443. [Google Scholar] - Velankar, S.; Valecha, S.; Maji, S. Bitcoin price prediction using machine learning. In Proceedings of the 2018 20th International Conference on Advanced Communication Technology (ICACT), Chuncheon, South Korea, 11–14 February 2018; IEEE: Piscataway, NJ, USA, 2018; pp. 144–147. [Google Scholar]
- Chen, Z.; Li, C.; Sun, W. Bitcoin price prediction using machine learning: An approach to sample dimension engineering. J. Comput. Appl. Math.
**2020**, 365, 112395. [Google Scholar] [CrossRef] - Atsalakis, G.S.; Atsalaki, I.G.; Pasiouras, F.; Zopounidis, C. Bitcoin price forecasting with neuro-fuzzy techniques. Eur. J. Oper. Res.
**2019**, 276, 770–780. [Google Scholar] [CrossRef] - Lamothe-Fernández, P.; Alaminos, D.; Lamothe-López, P.; Fernández-Gámez, M.A. Deep learning methods for modeling bitcoin price. Mathematics
**2020**, 8, 1245. [Google Scholar] [CrossRef] - Wu, C.H.; Lu, C.C.; Ma, Y.F.; Lu, R.S. A new forecasting framework for bitcoin price with LSTM. In Proceedings of the 2018 IEEE International Conference on Data Mining Workshops (ICDMW), Singapore, 17–20 November 2018; IEEE: Piscataway, NJ, USA, 2018; pp. 168–175. [Google Scholar]
- Phaladisailoed, T.; Numnonda, T. Machine learning models comparison for bitcoin price prediction. In Proceedings of the 2018 10th International Conference on Information Technology and Electrical Engineering (ICITEE), Bali, Indonesia, 24–26 July 2018; IEEE: Piscataway, NJ, USA, 2018; pp. 506–511. [Google Scholar]
- Sin, E.; Wang, L. Bitcoin price prediction using ensembles of neural networks. In Proceedings of the 2017 13th International Conference on Natural Computation, Fuzzy Systems and Knowledge Discovery (ICNC-FSKD), Guilin, China, 29–31 July 2017; IEEE: Piscataway, NJ, USA, 2017; pp. 666–671. [Google Scholar]
- Awoke, T.; Rout, M.; Mohanty, L.; Satapathy, S.C. Bitcoin Price Prediction and Analysis Using Deep Learning Models. In Communication Software and Networks; Springer: Singapore, 2021; pp. 631–640. [Google Scholar]
- Roy, S.; Nanjiba, S.; Chakrabarty, A. Bitcoin price forecasting using time series analysis. In Proceedings of the 2018 21st International Conference of Computer and Information Technology (ICCIT), Dhaka, Bangladesh, 22–24 December 2018; IEEE: Piscataway, NJ, USA, 2018; pp. 1–5. [Google Scholar]
- Cretarola, A.; Figà-Talamanca, G.; Patacca, M. Market attention and Bitcoin price modeling: Theory, estimation and option pricing. Decis. Econ. Financ.
**2020**, 43, 187–228. [Google Scholar] [CrossRef] [Green Version] - Nikou, M.; Mansourfar, G.; Bagherzadeh, J. Stock price prediction using DEEP learning algorithm and its comparison with machine learning algorithms. Intell. Syst. Account. Financ. Manag.
**2019**, 26, 164–174. [Google Scholar] [CrossRef] - Lei, J.; Lin, Q. Analysis of gold and bitcoin price prediction based on LSTM model. Acad. J. Comput. Inf. Sci.
**2022**, 5, 95–100. [Google Scholar] - Yu, J.; Shang, Y.; Li, X. Dependence and Risk Spillover among Hedging Assets: Evidence from Bitcoin, Gold, and USD. Discret. Dyn. Nat. Soc.
**2021**, 2021, 2010705. [Google Scholar] [CrossRef] - Sun, Y.; Xie, S.; Li, N. Research on Gold and Bitcoin Price Prediction Model and Sensitivity Analysis. World Sci. Res. J.
**2022**, 8, 468–471. [Google Scholar] - Zhou, Q.; Chen, Z.; Cai, Z.; Xia, Z. Prediction of the Best Portfolio for Bitcoin and Gold based on the ARIMA Model. Front. Bus. Econ. Manag.
**2022**, 4, 141–149. [Google Scholar] [CrossRef] - Liu, F.; Peng, Y.; Chen, Z.; Shi, Y. Modeling of characteristics on artificial intelligence IQ test: A fuzzy cognitive map-based dynamic scenario analysis. Int. J. Comput. Commun. Control.
**2020**, 14, 653–669. [Google Scholar] [CrossRef] [Green Version] - Klein, T.; Thu, H.P.; Walther, T. Bitcoin is not the New Gold—A comparison of volatility, correlation, and portfolio performance. Int. Rev. Financ. Anal.
**2018**, 59, 105–116. [Google Scholar] [CrossRef] - Qiu, Q.; Maillart, L.; Prokopyev, O.; Cui, L. Optimal Condition-Based Mission Abort Decisions. IEEE Trans. Reliab.
**2022**. [Google Scholar] [CrossRef] - Liu, X.; Masoud, N.; Zhu, Q.; Khojandi, A. A markov decision process framework to incorporate network-level data in motion planning for connected and automated vehicles. Transp. Res. Part C Emerg. Technol.
**2022**, 136, 103550. [Google Scholar] [CrossRef] - Dyhrberg, A.H. Bitcoin, gold and the dollar–A GARCH volatility analysis. Financ. Res. Lett.
**2016**, 16, 85–92. [Google Scholar] [CrossRef] - Ye, W.; Sun, L.; Miao, B. Dynamic Cointegration of Gold and Bitcoin based on Semi-parametric MIDAS fractional regression model. Syst. Sci. Math.
**2020**, 40, 1270–1285. [Google Scholar] - Kang, Y.Z. Analysis on the trajectory characteristics and influencing factors of gold price fluctuation. Mod. Enterp.
**2022**, 9, 94–96. [Google Scholar] - Zhang, D. Establishment, Evaluation and Improvement of Spot Gold Trading Strategy; Xinjiang University of Finance and Economics: Urumqi, China, 2015. [Google Scholar]
- Wang, Q.; Du, Z. Research on the difference between Bitcoin and gold hedging Function: Based on VAR-BEKK-GARCH model. Manag. Sci.
**2022**, 35, 134–146. [Google Scholar] - Meng, T. Currency Trading Data in Network Characteristics Research; Beijing University of Posts and Telecommunications: Beijing, China, 2021. [Google Scholar]
- Available online: https://www.comap.com/contests (accessed on 1 October 2022).
- Available online: https://www.python.org/downloads/windows/ (accessed on 1 October 2022).
- Available online: https://ww2.mathworks.cn/products/matlab.html (accessed on 1 October 2022).

Symbol | Description | Unit |
---|---|---|

PCT_change | Past price fluctuation | % |

HL_PCT | Maximum price difference in the past | % |

present_crash | Cash held after the transaction | $ |

present_gold | Post-trade gold holdings | oz.t |

$present\_bitcoin$ | Hold bitcoin after the transaction | BTC |

${\delta}_{1}$ | Change in the estimated price of gold (15 days later) | $/oz.t |

${\delta}_{2}$ | Change in the estimated price of bitcoin (after 15 days) | $/BTC |

$thePriceOfGold$ | The current price of gold | $ |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Li, J.; Rao, X.; Li, X.; Guan, S.
Gold and Bitcoin Optimal Portfolio Research and Analysis Based on Machine-Learning Methods. *Sustainability* **2022**, *14*, 14659.
https://doi.org/10.3390/su142114659

**AMA Style**

Li J, Rao X, Li X, Guan S.
Gold and Bitcoin Optimal Portfolio Research and Analysis Based on Machine-Learning Methods. *Sustainability*. 2022; 14(21):14659.
https://doi.org/10.3390/su142114659

**Chicago/Turabian Style**

Li, Jingjing, Xinge Rao, Xianyi Li, and Sihai Guan.
2022. "Gold and Bitcoin Optimal Portfolio Research and Analysis Based on Machine-Learning Methods" *Sustainability* 14, no. 21: 14659.
https://doi.org/10.3390/su142114659