Case Study: ETH 5-min Price Prediction with Allora Network

Allora Team
November 18, 2024

Allora Labs is excited to announce the release of ETH-USD 5min Price Prediction topic. As part of the topic instantiation, Allora Labs has deployed an inference worker for this topic which has been developed by our team to assist in the bootstrapping of this topic to provide high-quality, predictive alpha. A detailed outline of how this model was developed, trained, its capabilities and use cases can be found below.

As a reminder, this document outlines the specifics and performance of an individual model. Once live, the Allora Network will provide a single inference that is an aggregation of multiple inferences that have undergone the Allora Synthesis Logic. Ultimately, this results in a network output that consistently outperforms any of the individual models within a topic.

Model Development

The development of the ETH/USD price prediction model was driven by a need to provide actionable insights in rapidly shifting market conditions. Allora Labs leveraged historical market data sourced from Tiingo to capture relevant patterns and anomalies that could inform price movements. This model is built around technical indicators, which include moving averages, volatility measures, and other signals commonly used in financial modeling.

To enhance predictive power, the model employs the AutoGluon framework, which allows for an ensemble approach, effectively combining multiple individual models to increase accuracy and robustness. The ensemble model mitigates the risks associated with relying on a single algorithm by aggregating the strengths of different models, each optimized for specific market behaviors. This approach allows for more stable predictions in highly volatile environments, making it a strategic tool for DeFi protocols seeking a reliable ETH price forecast.

Training Process

The training process was structured to optimize for real-time responsiveness and adaptability. Historical price data over the course of an 8 week period is used to build the foundation of the model, with the optimal amount of data points selected to balance training depth and recency. During training, AutoGluon’s framework tests various model configurations, employing techniques such as stacking and bagging to refine the ensemble’s predictive strength. This iterative process is guided by performance metrics, including Mean Absolute Error (MAE), Root Mean Squared Error (RMSE), and R-squared, which provide a quantitative assessment of the model's accuracy.

To ensure sustained relevance in a dynamic market, the model is periodically retrained, incorporating recent data to adapt to evolving trends. In cases of significant market shifts, dynamic retraining may be triggered based on key performance metrics, ensuring that the model remains robust and aligned with real-time market conditions. This strategy of adaptive retraining allows the ETH/USD prediction model to maintain high-quality predictive alpha, enabling DeFi protocols to rely on proactive rather than reactive decision-making. While the model provides strong predictive alpha, it naturally has space for further improvement; it may be sensitive to extreme market events or abrupt changes outside of the training data’s range. As we open-source the model, others can build upon this foundation to enhance its accuracy and adaptability.

Test Results

In order to determine the effectiveness of a model, a proper baseline must be established. As it stands today, many DeFi protocols are basing their strategies off the current price of an asset.  Therefore, utilizing the current price of ETH-USD as a prediction for what the price would be in five minutes is a good point of reference: in order to provide value, a time series forecast must outperform the baseline set by the current price of an asset. The test results of the model can be seen below:

The above scatter plot shows the predicted logarithmic returns (y-axis) versus the actual logarithmic returns (x-axis). The logarithmic returns reflect the price movement and are calculated as the natural logarithm of the ratio between the price in five minutes and the current price. The red horizontal line represents the zeroth-order assumption that the current price of ETH-USD will be the exact same as the price of ETH-USD in five minutes. Since this assumption would result in a predicted movement of zero, it results in a horizontal line across the x-axis.

Conversely, the black line represents how a model that was able to perfectly predict the exact price of ETH-USD every round would appear.

Put simply, a horizontal line across the x-axis valued at zero on the y-axis would represent a model that provides no predictive alpha in comparison to using the current price as a forecast (red line). A diagonal line progressing from the top-left to the bottom-right corner would represent a model that is much worse than utilizing a baseline of the current price (marked by the grey-shaded regions and the “Incorrect direction” label). Finally, a diagonal line progressing from the bottom-left to the top-right corner would represent a model that is much more predictive than the baseline of using the current price as the forecast (black line).

The scatter plot clearly shows that the data follow the black line more closely than the red line. This shows that the model provides predictive alpha.

As part of the benchmarking process, the model is evaluated against the zeroth-order assumption using various metrics, including the Mean Absolute Error (MAE; lower is better), Root Mean Square Error (RMSE; lower is better), and Correlation of Determination (R²; higher is better).

1. Mean Absolute Error (MAE) and Root Mean Square Error (RMSE)

What is the MAE?

Mean Absolute Error (MAE) measures the average magnitude of errors between the model’s predicted prices and the actual prices, without considering their direction (whether the prediction was too high or too low). In other words, it tells observers, on average, how much the model’s predictions are "off" from the real prices. It is calculated by taking the average of the absolute differences between the predictions and the actual values.

What is the RMSE?

Root Mean Square Error (RMSE) also measures the average error between the model’s predictions and actual values, but it penalizes larger errors more than MAE because it squares the errors before averaging. It provides a sense of how spread out these errors are. A lower RMSE indicates that large errors are less frequent.

What does it mean that the model’s MAE is 28.6% lower and its RMSE is 24.4% lower than the baseline?

Both metrics provide a measure of how far the model’s predicted returns are separated from the realized returns on average. The metrics differ in how they average, but otherwise their measure a similar quantity. We find that the model's predictions are, on average, 24.4%-28.6% more accurate than the baseline of using the current price as the forecast. If the baseline had an average error of, say, $10, the model's average error would be around $7.14-$7.56.

This significant reduction means the model consistently provides closer estimates to the actual future price compared to just assuming the price remains the same over the next 5 minutes.

2. R-squared (R²)

What is R²?

R² (also called “Coefficient of Determination”) is a statistical measure that represents the proportion of the variance for the dependent variable (ETH price) that's explained by the model. It ranges from -1 to 1, where 1 means perfect prediction, 0 means the model does no better than simply using the average of the actual prices, and -1 indicates a perfect anti-correlation between the predicted and realized price. In summary, a higher R² indicates a better fit between the model's predictions and the actual data.

What does a 0.43 R² mean?

An R² of 0.4272 means that about 42.72% of the variability in ETH's future prices is explained by the model. The baseline's R² of -0.002 is effectively zero, indicating it doesn't explain any variability. In other words, the model captures a significant portion of the factors that cause ETH’s prices to change, while the baseline model does not capture these factors at all.

3. Directional Prediction Martix

The right-hand panel of the above figure shows a directional prediction matrix, which quantifies whether the direction of the price movement is predicted correctly. The four quadrants represent all possible combinations of actual and predicted directions:

Positive (true) - Positive (predicted): 42.3%

In 42.3% of cases, the price increased, and the model correctly predicted this increase.

Negative (true) - Negative (predicted): 33.9%

In 33.9% of cases, the price decreased, and the model correctly predicted this decrease.

Positive (true) - Negative (predicted): 10.1%

In 10.1% of cases, the price increased, but the model incorrectly predicted a decrease.

Negative (true) - Positive (predicted): 13.6%

In 13.6% of cases, the price decreased, but the model incorrectly predicted an increase.

When viewed in totality, the model correctly predicted the direction of ETH-USD’s price movement 76.2% of the time. This is 9.7 standard deviations better than random guessing and 8.8 standard deviations better than a simple trend-following strategy (e.g. if the price mostly went up, it is predicted to always go up).

4. Summary of Findings

In conclusion, the testing demonstrates that the model has a strong ability to predict short-term ETH price movements considerably more accurately than the simple assumption that price will remain constant over a 5-minute interval. The reductions in MAE and RMSE indicate more precise and reliable predictions, while the substantial increase in R² shows that the model captures underlying trends and patterns that the baseline does not. In relation to directionality, the model doesn't just follow the current trend; it provides insights that significantly outperform basic strategies like assuming the price will continue in the same direction.

Use Cases

Due to the lack of publicly available models which provide predictive alpha for the price of a crypto asset, the current generation of existing DeFi strategies are static in nature and based on linear math. Once a strategy is deployed it executes a static strategy that either does not react to changing market conditions or at best is reactive to changes in market conditions. The Allora Network presents a paradigm shift in how DeFi strategy creators and protocols can begin approaching the creation of new strategies or mechanisms within their protocols.

  • For automated liquidity managers, instead of being reactive to changes in the spot price of a trading pair, they are now able to create much more capital efficient strategies which take the future price of an asset over various time frames (e.g. 5-min, 1-hour, 24-hours) into account. This enables strategies to achieve higher returns while also minimizing exposure to risks such as impermanent loss.
  • Another great example where accurate price forecasting can be impactful is looping strategies. Looping strategies operate by taking a participant’s funds and utilizing those funds to take out an overcollateralized loan on a lending protocol. The capital received via the loan is then “looped” by adding it as additional collateral to the original loan in order to take out an even larger loan. This cycle can be repeated several times depending on a user’s risk tolerance. While a looping strategy provides the benefit of additional exposure to an asset, it carries the risk of increasingly smaller fluctuations in price being able to liquidate the user’s position. Currently, a user must actively and manually monitor their collateral asset’s price and decrease leverage when necessary in order to avoid liquidation. With an accurate forecast of price now available via the Allora Network, it is possible to build automated strategies which increase leverage when a collateral asset is forecasted to increase and decrease leverage when the price of a collateral is expected to decrease. This provides users a safe looping strategy which can autonomously increase exposure when appropriate and decrease exposure, including closing out a loan entirely, when necessary to avoid liquidation.
  • A third example where accurate price forecasting can be utilized is within DCA strategies. Current DCA strategies operate in a linear fashion by acquiring a set amount of an asset at regular intervals, while more sophisticated strategies may also incorporate limit orders which can also purchase an asset based on increases or decreases to price in a reactive manner. Accurate price forecasts for an asset provide DCA strategies to become more sophisticated and dynamic by leveraging forecasts for various time intervals (e.g. 5-min, 1-hour, 24-hours, 72-hours, and 1-week) to determine the most optimal time to acquire an asset while also dynamically varying the amount of a user’s overall capital to allocate to a specific purchase, based on the forecasted future price. An example of this would be, a DCA strategy receiving forecasts that indicate while an asset’s price is predicted to increase over the next 24 hours, the 72-hour forecast indicates that the asset will retrace to below its current price slightly further into the future. This allows the strategy to purchase a small amount of the asset at its current price as a hedge against the forecast being incorrect, but retain more capital for a larger purchase 72-hours into future when the price is forecasted to be lower. This enhanced DCA strategy ultimately allows the user to acquire more of their desired asset once the strategy has concluded its purchases.
  • The final example we will cover is trading strategies. Having accurate forecasts for the future price of an asset allows for the creation of automated strategies which trade a single asset or multiple assets with a high precision as well as simultaneously execute advanced risk management strategies such as hedging. These trading strategies can either be directional or delta neutral in nature. While algorithmic trading has historically been limited to sophisticated participants such as market makers, highly accurate feeds that provide forecasts for the future price of an asset via the Allora Network allows anyone to build bespoke trading strategies which leverage artificial intelligence to autonomously operate around the clock 24 hours a day, 7 days a week.

Contact Us

If you would like to discuss a price forecasting feed for a specific asset or discuss potential use cases with the team at Allora Labs, please feel free to contact us here.