While exploring Uniswap V3 I came across an interesting problem “predict volume on Uniswap for next 12 weeks“. The moment I read about it the first thought flashed in my mind is “this is a data science problem”. I followed my thoughts and ended up learning basics of data science and used it to predict Uniswap V3 volume for next 12 weeks.
Data science models are good at forecasting with time series data. The problem I’m trying to solve is also related to time series forecasting. Out of several data science models available on python ecosystem the Facebook Prophet stands out. Prophet model provides good performance with high accuracy and also automates a lot of elements like hyperparameter selection and feature engineering. It is also relatively straightforward to use so it was a right one for a newbie like me.
After learning basics of how Facebook Prophet works using this post on databricks I extracted Uniswap V3 daily transaction volume from Flipside Crypto data warehouse. Thankfully I did not go through time consuming data cleansing process as Flipside Crypto does all the heavy lifting. They extracting data from Ethereum blockchain, clean it thoroughly and label it.
I trained the model with past data and then instructed it to forecast transaction volume (usd) for next 12 weeks. Here is the forecast generated by Facebook Propet.
If the forecast chart is intimidating then don’t worry. The vertical red line divides the past volume recorded on Uniswap from the predicted future volume. The black dots represent the actual volume recorded in the past. The dark blue line shows the prediction and the lighter blue band represents the uncertainty interval.
Alternate Approaches
Before settling with Data Science model Facebook Prophet, I explored alternate approaches ranging from naive models to some complex neural networks based models. Couple of naive approaches I tried are using Google Sheets & Microsoft Excel built-in functions for forecasting. They are simple to use for anyone with basic spreadsheet skills but their ability to predict future is highly inaccurate. If you are interested in learning about them check these docs on Microsoft Excel and Google Sheets website.
The models like NuralProphet and scikit-learn were interesting but I settled down with Prophet as it was good enough to solve the problem.
Pingback: Projecting Uniswap V3 Total Value Locked Using Flipside Crypto and Google BigQuery ML