arrow_backBack to research feed
otherPublished: July 16, 2026

Decoding Market Emotion from Blockchain Activity: A Data-Driven Sentiment Classifier

By Arthur G. Bubolz, Abreu Quevedo, Giancarlo Lucca, Rafael A. Berri, Eduardo Borges, Bruno L. Dalmazo

Research TL;DR

"Combines on-chain, financial, and Twitter data to classify Bitcoin sentiment; XGBoost achieves F1 ~0.84, with SHAP revealing feature contributions."

Abstract

The growing use of Bitcoin as a decentralized digital asset and investment tool has sparked strong interest in understanding its market behavior. This study presents a new approach to analyze Bitcoin market sentiment by combining on-chain and financial data with social media posts. Unlike models that aim to predict prices, this work focuses on explaining market sentiment using blockchain transactions, historical price data of Bitcoin, and daily Twitter sentiment classifications. The method merges sentiment trends with on-chain and financial metrics, normalized into a dataset for detailed market analysis. Multiple machine learning models were tested using cross-validation, with Gradient Boosting (XGBoost) emerging as the most reliable model for classifying sentiment, achieving an average F1-score of about 0.84. SHAP (SHapley Additive exPlanations), a game theory-based method for model interpretability, was used to quantify the contribution of on-chain features to the model's predictions, improving transparency. The results indicate that this data combination yields meaningful predictive signals and insights, supporting data-driven cryptocurrency analysis and future improvements with deep learning.

Technical Analysis & Implementation

Summary§

This paper presents a data-driven approach to classify Bitcoin market sentiment into bullish, bearish, or neutral categories by fusing on-chain metrics (e.g., transaction volume, active addresses), price data (returns, volatility), and daily Twitter sentiment scores. The authors benchmark several classifiers under cross-validation; Gradient Boosting (XGBoost) yields the best average F1-score of 0.84. Model interpretability is provided via SHAP values, quantifying the impact of each on-chain feature on predictions.

Methodology§

Dataset Construction§

  • On-chain data: Blockchain transaction counts, average transaction value, miner revenue, hash rate, etc.
  • Financial data: Daily close price, returns, volatility, trading volume.
  • Twitter sentiment: Precomputed daily sentiment polarity scores (positive/negative/neutral percentages).

All features are normalized (z-score) and aligned by date. The target variable is discretized sentiment from Twitter (3 classes).

Model Training§

Six classifiers are compared: logistic regression, random forest, SVM, k-NN, AdaBoost, and XGBoost. Stratified 5-fold cross-validation is used. XGBoost hyperparameters are tuned via grid search: number of estimators (100–500), max depth (3–10), learning rate (0.01–0.3), subsample ratio, etc.

XGBoost Objective§

XGBoost minimizes the regularized objective: $$\mathcal{L} = \sum_{i=1}^{n} l(y_i, \hat{y}_i) + \sum_{k=1}^{K} \Omega(f_k)$$ where $l$ is the softmax cross-entropy loss for multi-class classification, and $\Omega(f_k) = \gamma T + \frac{1}{2}\lambda \|w\|^2$ penalizes tree complexity.

SHAP for Interpretability§

SHAP values are computed for each feature $j$ as: $$\phi_j = \sum_{S \subseteq F \setminus \{j\}} \frac{|S|!(|F|-|S|-1)!}{|F|!} [f_{S \cup \{j\}}(x_{S \cup \{j\}}) - f_S(x_S)]$$ where $F$ is the set of all features, and $f_S$ is the model trained only on features in $S$. This provides additive feature importance scores for each prediction.

Code Snippet (PyTorch-like for reference)§

import xgboost as xgb
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import f1_score
import numpy as np

# Assume X (features), y (labels) are prepared
params = {
    'objective': 'multi:softprob',
    'num_class': 3,
    'max_depth': 6,
    'eta': 0.1,
    'subsample': 0.8,
    'colsample_bytree': 0.8,
    'eval_metric': 'mlogloss'
}

skf = StratifiedKFold(n_splits=5, shuffle=True, random_state=42)
f1_scores = []

for train_idx, val_idx in skf.split(X, y):
    X_train, X_val = X[train_idx], X[val_idx]
    y_train, y_val = y[train_idx], y[val_idx]
    dtrain = xgb.DMatrix(X_train, label=y_train)
    dval = xgb.DMatrix(X_val, label=y_val)
    model = xgb.train(params, dtrain, num_boost_round=100, early_stopping_rounds=10, evals=[(dval, 'val')], verbose_eval=False)
    preds = np.argmax(model.predict(dval), axis=1)
    f1_scores.append(f1_score(y_val, preds, average='weighted'))

print('Mean F1:', np.mean(f1_scores))

# SHAP explanation
import shap
explainer = shap.TreeExplainer(model)
shap_values = explainer.shap_values(X_val)
shap.summary_plot(shap_values, X_val, feature_names=feature_names)

Results§

XGBoost achieves the highest average weighted F1-score of 0.84 across folds, outperforming other models by ~5–10%. SHAP analysis reveals that the most important features are Twitter sentiment polarity, transaction volume change, and Bitcoin returns from the previous day.

Conclusion§

The combination of on-chain, price, and social media data yields robust sentiment classification. Future work may incorporate deep learning models (e.g., LSTM) to capture temporal dependencies.

SHARE RESEARCH: