This project is best viewed/ran in Google Colab! ->
This is my time series analysis of Mercado Libre's Google search trend and stock price data to find out if the ability to predict search traffic can translate into the ability to successfully trade the stock. In my analysis I visualize the data's seasonality, evaluate how the company's stock price correlates to its Google search traffic, and use Facebook's Prophet to train a machine learning model that forecasts search traffic and future revenue.
- google_hourly_search_trends.csv - Hourly Google search traffic values 2016-2020
- mercado_stock_price.csv - Closing stock price values 2015-2020
- mercado_daily_revenue.csv - Daily revenue reported in millions of dollars 2019-2020
I start by finding unusual patterns in the Google search traffic, and to do so I look at the data from May 2020 which was the trends during peak Covid. For that month I compare the total search traffic to the median total search traffic across the whole dataset.
Then I look for seasonality in the search trends by analyzing the search traffic based on day of the week and week of the year.
Next I analyze the stock price with the Google search trends to see if there are any correlating relationships between them.
After that I use Prophet to train a machine learning model to make in and out of sample forecasts (80 days out of sample).
Finally, I again use Prophet to create another model to forecast the next quarter's potential revenue based on the sales data.
This is a Python 3.8 project ran in Google Colab but can be used in JupyterLab using a Conda dev environment.
The following dependencies are used:
- Jupyter - Running code
- Conda (4.13.0) - Dev environment
- Pandas (1.3.5) - Data analysis
- Matplotlib (3.5.1) - Data visualization
- Numpy (1.21.5) - Data calculations + Pandas support
- hvPlot (0.8.1) - Interactive Pandas plots
- Holoviews (1.14.9) - Interactive Pandas plots
- PyStan (3.3.0) - Prophet support
- Prophet (1.1.1) - Machine learning time series forcasting models
The Google Colab notebook installs the required dependencies in the first cell:
# Install the required libraries
!pip install pystan
!pip install prophet
!pip install hvplot
!pip install holoviews
If you would like to run the program in JupyterLab, install the Anaconda distribution and run jupyter lab
in a conda dev environment.
To ensure that your notebook runs properly you can use the requirements.txt file to create an exact copy of the conda dev environment used in development of this project.
Create a copy of the conda dev environment with conda create --name myenv --file requirements.txt
Then install the requirements with conda install --name myenv --file requirements.txt
The Jupyter notebook forecasting_net_prophet.ipynb will provide all steps of the data collection, preparation, and analysis. Data visualizations are shown inline and accompanying analysis responses are provided. It can be uploaded to Google Colab with the provided .csv files in /Resources
, or can be viewed in the GitHub uploaded version
This project uses the GNU General Public License