Golden Insights: Harnessing Machine Learning for Price Forecasting

Andre Vianna
My Data Science Journey
4 min readNov 18, 2021

with Sklearn Ensemble & Random Forest Algorithm

Gold Price Prediction

Gold as a Investment

Of all the precious metals, gold is the most popular as an investment. Investors generally buy gold as a way of diversifying risk, especially through the use of futures contracts and derivatives. The gold market is subject to speculation and volatility as are other markets. Compared to other precious metals used for investment, gold has been the most effective safe haven across a number of countries.

Gold Price

Gold has been used throughout history as money and has been a relative standard for currency equivalents specific to economic regions or countries, until recent times. Many European countries implemented gold standards in the latter part of the 19th century until these were temporarily suspended in the financial crises involving World War I. After World War II, the Bretton Woods system pegged the United States dollar to gold at a rate of US$35 per troy ounce. The system existed until the 1971 Nixon Shock, when the US unilaterally suspended the direct convertibility of the United States dollar to gold and made the transition to a fiat currency system. The last major currency to be divorced from gold was the Swiss Franc in 2000.

Since 1919 the most common benchmark for the price of gold has been the London gold fixing, a twice-daily telephone meeting of representatives from five bullion-trading firms of the London bullion market. Furthermore, gold is traded continuously throughout the world based on the intra-day spot price, derived from over-the-counter gold-trading markets around the world (code “XAU”). The following table sets out the gold price versus various assets and key statistics at five-year intervals.

Gold Price Prediction

Historically, gold was used for supporting trade transactions around the world besides other modes of payment. Various states maintained and enhanced their gold reserves and were recognized as wealthy and progressive states. In present times, precious metals like gold are held with central banks of all countries to guarantee re-payment of foreign debts, and also to control inflation. Moreover, it also reflects the financial strength of the country. Besides government agencies, various multi-national companies and individuals have also invested in gold reserves. In this Experiment , Results show that we can predict the daily gold rates very accurately. Our prediction models will be beneficial for investors, and central banks to decide when to invest in this commodity.

Gold Price Dataset

Data Description

This data file is a Comma separated value file format with 2290 rows and 7 columns. It contains 5 columns which are numerical in datatype and one column in Date format. Clearly the data shows value of the variables SPX,GLD,USO,SLV,EUR/USD against the dates in the date column.

Notebook

Python Notebook Demo

--

--

Andre Vianna
My Data Science Journey

Software Engineer & Data Scientist #ESG #Vision2030 #Blockchain #DataScience #iot #bigdata #analytics #machinelearning #deeplearning #dataviz