- Bitcoin Insights
- Posts
- đ Bitcoin Sentiment Analysis
đ Bitcoin Sentiment Analysis
How Perpetual Indicators Impact Bitcoin's Sentiment
Welcome to another edition of Bitcoin Insights. This week, weâre taking a look at perpetual futures markets to better gauge broader sentiment in the Bitcoin market.
We do this by identifying three key metrics which directly impact the relationship between the spot and perpetuals markets, and then plug these into the Random Forest machine learning model.
The result was further refined in order to achieve what we believe to be rather interesting insights into the dynamics of Bitcoinâs sentiment.
Letâs dive in!
âď¸ Estimated Read Time: 1.3 Blocks (~14 Mins)
Need professional assistance with your Bitcoin self-custody?
21st Capital have onboarded over 1,000 families and institutional clients!
Table of Contents
Introduction
Derivative markets, particularly futures, have a long history dating back to ancient civilizations. The modern futures market originated in Japan in the 17th century with rice futures and gained prominence in the United States in the mid-19th century with the Chicago Board of Trade.
Futures contracts allowed farmers and merchants to hedge against price fluctuations in agricultural commodities. Over time, futures expanded to include financial instruments, currencies, and other assets, becoming essential for risk management and price discovery in global markets.
Perpetual Futures in cryptocurrency emerged as an innovation in the digital asset space, first introduced by BitMEX in 2016. Unlike traditional futures with expiration dates, perpetual futures contracts can be held indefinitely (i.e. the investors could maintain leveraged positions without requiring the need to indefinitely âroll overâ contracts).
As such, they quickly gained popularity as major exchanges like Binance, Bybit, and many others adopted perpetual futures, resulting in a billion dollar market (see chart below).
Source: Glassnode
The interconnection between the Spot and Perpetual Futures Markets in cryptocurrency ecosystem can be characterized by one or multiple following mechanisms
Arbitrage Opportunities: Perpetual futures prices tend to closely track spot prices due to arbitrage opportunities. Traders exploit price discrepancies between the two markets, which helps maintain price alignment.
Hedging Opportunities: Spot Bitcoin holders often use perpetual futures to hedge their positions without selling their underlying actual assets.
Market Adjustments: Capital often moves between spot and futures markets as traders adjust their strategies or respond to market conditions, affecting liquidity in both markets.
Source: Glassnode
Weâre able to track the extent of the above relationship by assessing three primary metrics, namely:
Open Interest
Liquidations (both long and short)
Funding rates
Open Interest, which represents the total number of outstanding contracts in the market, provides additional context by indicating the overall market participation level and potential for price impact.
Liquidations serve as a more abrupt corrective measure. When prices diverge significantly, over-leveraged positions often face forced closures, causing rapid price movements that quickly bring the perpetual price back in line with the spot price. This mechanism safeguards against extreme divergences, reinforcing the link between the spot and perpetuals markets.
Funding rates act as a continuous balancing force, where traders holding positions against the market trend are required to pay those who are aligned with it. This creates a financial incentive for traders to adjust their positions, gradually pushing the perpetual price towards the spot price.
Analyzing the above three metrics can help provide a sentiment barometer for Bitcoinâs price, with favorable funding rates signaling bullish expectations and negative funding rates reflecting a more bearish market sentiment. The magnitude of these rates further reflects the intensity of the broader marketâs conviction, while liquidations are stress indicators that may highlight potential future volatility and critical price levels.
By closely monitoring these metrics, traders can gauge the overall market sentiment, anticipate potential price swings, identify possible trend reversals and make more informed decisions.
Perpetual Indicators in Sentiment Analysis
In this next section, we provide a framework which utilizes the above mentioned three key metrics (open interest, liquidations and funding rates) to better understand Bitcoin market sentiment.
Open Interest
Short term deleveraging/speculative events often manifest themselves in sharp changes in open interest. However, over longer term horizons, we notice that perpetual markets typically trade in a more stable range until a substantial market shock occurs.
To better understand the mechanics of the perpetual markets, we have measured the percentage share of open interest for the top three exchanges (Binance, Bybit and OKX) which cumulatively comprise ~82% of the overall market share.
Source: Glassnode
Significant shifts in the perpetual futures market are often marked by a substantial decrease in open interest, frequently triggered by the forced closure of highly leveraged positions due to margin calls. This phenomenon is commonly referred to as a market "flush out" or "reset".
The graph below illustrates previous instances where the combined open interest across the three leading exchanges experienced a decline exceeding 5% within a single week. In the past year, we've observed ten such events in the perpetual futures market, each representing a notable reset in market positioning.
Source: Glassnode
Liquidation Volume [Long and Short]
We can quantify the aggregate liquidation volume during these deleveraging periods to gauge the magnitude of involuntary position closures. The graph below illustrates the combined liquidation volume (encompassing both long and short positions) exceeding the usual bull market threshold of $200 million per day (black dotted line below).
Source: Glassnode
This liquidation spike correlates directly with the decrease in open interest depicted previously, underscoring the impact that forced position closures have upon Bitcoinâs market dynamics.
Market turbulence can trigger deleveraging events in both upward and downward price movements. However, in our analysis, we're specifically focusing on potential pivot points during bull market corrections.
To this end, we've categorized the liquidations into two distinct groups:
đ˘ Long-Biased Liquidations [Green Circles]: Instances where over 50% of the liquidated positions were long contracts.
đ´ Short-Biased Liquidations [Red Circles]: Cases where more than 50% of the forced closures involved short contracts.
Source: Glassnode
This categorization allows us to better understand the nature of subsequent market resets and their potential implications for future price movements within a structural bull market trend.
Funding Rates
Using funding rates, we can systematically identify these pivot points by analyzing the perpetual funding rate. The method employs a 7-day moving average of funding rates from the three leading exchanges referenced above.
This metric offers some valuable insight into the directional preferences of traders in perpetual markets. When the weekly average funding rate surpasses the neutral threshold of 0.01% per 8-hour period (shown in the green circle below), it indicates a significant appetite among market participants to establish long positions.
Source: Glassnode
By incorporating the described methods, we can more accurately pinpoint potential market inflection points and better contextualize liquidation events and open interest changes we discussed previously.
Unfortunately however, this above framework is predominantly qualitative in nature. The next section of this report aims to solve for this by using a machine learning model to more accurately quantify these observations.
Quantifying Risk with Machine Learning
We have decided to apply a machine learning model [Random Forest] to predict the spot price movements five days into the future based on information from the futures market.
Methodology
Random Forest is an ensemble learning method for classification and regression tasks. This technique builds multiple decision trees during training, where each tree is constructed using a random subset of the data, and features are randomly selected at each split.
By combining the predictions of multiple trees, Random Forest outputs either the mode of the classes (for classification) or the mean prediction (for regression). This approach helps to reduce overfitting and increases robustness, making Random Forest highly accurate and flexible, especially in handling large datasets with high dimensionality.
To further enhance accuracy and prevent overfitting, we utilize cross-validation and the separation of data into training and testing sets. The training set fits the model, enabling it to learn the underlying patterns within the data. In contrast, the test set is reserved for evaluating the model's performance on unseen data. This separation is crucial because it allows for an unbiased assessment of the model's ability to generalize beyond the training data.
By ensuring that the model performs well on the test set, we can be more confident in its robustness and applicability to real-world scenarios. This methodology helps in preventing overfitting, where a model might otherwise learn noise within the training data, leading to poor performance on new data.
Dataset
The dataset spans a period of 1,485 days, starting from August 6, 2020, and extending through August 29, 2024. This timeframe covers a total of 48 months, equivalent to approximately four years. The data is continuous, with no gaps in the recorded days, ensuring a complete and uninterrupted time series across the entire duration. The broad span of the dataset provides a robust basis for analyzing trends and patterns over a significant period, capturing the nuances of both short-term fluctuations and longer-term shifts.
The independent variables (a.k.a. âfeaturesâ) in our dataset include the funding rate, open interest, and long and short liquidations of all bitcoin exchanges that offer perpetual futures contracts.
The dependent variable is the percentage of price change five days in the future.
Performance
The model's performance, as evaluated on the test set, shows a very high level of accuracy and predictive power.
The Mean Absolute Error (MAE) of 0.0437 indicates that, on average, the model's predictions deviate from the actual values by only about 4.37%.
The Root Mean Square Error (RMSE) of 0.0592 reflects the model's error magnitude, suggesting that larger errors occur less frequently but still somewhat impact the overall performance.
The R-squared (R²) value of 0.2950 indicates that approximately 29.5% of the variance in the test data is explained by the model, indicating that it captures important underlying patterns.
Predictions
Recall that that the main dependent variable is the percentage of price change five days in the future. The following image shows the actual percent change against the predicted moves.
Source: @CryptoVizArt and @Sina_21st
We can also take these percent price changes and convert them into actual price predictions by taking the actual price on every date and applying the predicted change to obtain the predicted price 5 days later. This chart shows a strong fit between predictions and actual values.
Source: @CryptoVizArt and @Sina_21st
Zooming in (chart below) at the prediction performance we observe that the model captures many of Bitcoinâs directional price movements but doesnât perfectly predict how big a crash or pump will be.
Source: @CryptoVizArt and @Sina_21st
Remember that the R2 is approximately 30% meaning 70% of the data remains unexplained. Yet, being able to predict 30% of price movement in a complex financial market only using the derivatives is a substantial achievement.
So, Did the Model Work?
One way to measure the accuracy of predictions is to color the price by the predictions. In this chart, we add red or green dots to show crash and pump predictions. The higher the magnitude of the prediction, the larger and darker the dot will be.
For example, at the first top of the the last cycle in early 2021 the model predicted a high likelihood of a crash as shown with a large red dot. and at the bottom of the bear market at the price of $16K, the model predicted a high likelihood of a pump shown with a large green dot.
Source: @CryptoVizArt and @Sina_21st
You can see that in many of the local tops and local bottoms the model was able to correctly identify the short-term price moves.
Which Variables are most Important?
To answer this question, we can use the variable importance plot below.
The plot shows that Open Interest features (named as [ExchangeName]_oi) are the most important for prediction followed by the funding rate (named as [ExchangeName]_fr). Long and short liquidations (shr-lq-⌠or lng-lq-âŚ) are also important on the margin.
Lastly, a richer way to visualize the influence of different variables is via the SHAP Summary plot (a visualization tool used in machine learning to interpret the contribution of each feature to the model's predictions).
The tool displays the SHAP values, which represent the impact of each feature on the output of the model, calculated based on game theory principles. The plot typically shows features ranked by their importance on the y-axis, with each dot representing a single SHAP value for a feature in the dataset.
The color of the dots often indicates the value of the feature (e.g., red for high values and blue for low values), and the spread of the dots along the x-axis shows the range of SHAP values, indicating how much a feature contributes to pushing the prediction higher or lower.
By interpreting the SHAP summary plot, one can understand not only which features are most influential in the model but also how they interact with each other and affect the predictions. This makes SHAP summary plots a powerful tool for gaining insights into model behavior and improving model interpretability.
Key Takeaways
In this article, we explored the effect that the perpetual futures market had on the spot Bitcoin price, focusing on three key metrics (funding rates, liquidations, and open interest).
We found these elements served as essential indicators of market sentiment and short-term price fluctuations. Funding rates for example, consistently guided perpetual prices back in line with spot prices, liquidation events often lead to rapid market corrections and significant changes in open interest typically signaled the direction of future price changes.
To quantify these dynamics, we implemented a Random Forest model which was trained on a ~4 year dataset. The model's performance was strong, with an R² of 29.5%. This captured significant patterns in the data, yet still offered room for future improvement.
To gain deeper insights into the modelâs behavior, we used variable importance and SHAP summary plots, which clearly highlighted the most influential features driving the modelâs predictions. This level of detail is crucial for refining trading strategies.
In summary, this analysis has demonstrated that by closely monitoring and modeling key perpetual futures market metrics, we can gain a better understanding of price dynamics and make more informed investing decisions.
Pure Signal or Just Noise?Rate the quality of this article |
Nerwisk-assessment