Skip to content

Alankrit005/research-backed-data-engineering-repository

Repository files navigation

Bitcoin Market Sentiment × Trader Performance Analysis

A quantitative study correlating the Crypto Fear & Greed Index with live trader behavior on the Hyperliquid exchange — and a data-driven strategy that improved per-trade profitability by 57.4%.


Table of Contents


Overview

This project explores a fundamental question in crypto trading: does market sentiment measurably affect trader profitability, and can we exploit that relationship?

By merging 211,000+ trade records from the Hyperliquid perpetuals exchange with daily Fear & Greed Index readings, this analysis uncovers clear behavioral patterns across sentiment regimes — and engineers a filtering strategy that systematically avoids low-signal environments.


Key Results

Metric Value
Total Trades Analyzed 211,000+
Baseline Avg. Closed PnL $48.55
Strategy Avg. Closed PnL $76.43
Performance Lift +57.4%
Worst Sentiment Regime Neutral ($34.31 avg PnL)

Bottom line: Traders who avoid "Neutral" sentiment windows and align direction with extreme sentiment phases capture significantly higher per-trade returns.


Dataset

Source Description
historical_data.csv Raw trade records from Hyperliquid — includes timestamp, direction, size, and Closed PnL
fear_greed_index.csv Daily Fear & Greed Index readings (0–100) with categorical labels
submission_results.csv Merged and enriched output with sentiment classifications per trade

Sentiment categories used: Extreme Fear · Fear · Neutral · Greed · Extreme Greed


Strategy Logic

The Smart Sentiment Engine applies three counter-cyclical rules derived from the data:

1. BUY  →  Prioritized during [ Extreme Fear ] and [ Fear ]
              Contrarian accumulation when the crowd panic-sells.

2. SELL →  Prioritized during [ Extreme Greed ]
              Profit realization ahead of potential mean reversion.

3. SKIP →  All activity filtered out during [ Neutral ]
              Noise reduction — Neutral regimes show the lowest
              signal-to-noise ratio across all sentiment bands.

This is a signal filter, not a standalone trading system. It is designed to be layered on top of any existing directional strategy to improve regime-adjusted performance.


Analysis Highlights

Sentiment vs. Average PnL

Sentiment Avg Closed PnL Signal Quality
Extreme Fear High ✅ Strong
Fear Above Average ✅ Good
Neutral $34.31 ❌ Weak
Greed Above Average ✅ Good
Extreme Greed High ✅ Strong (SELL bias)

The "Neutral Trap"

Neutral sentiment is not a safe middle ground — it produces the lowest average PnL of any category. This is attributed to elevated market noise and indecisive price action, resulting in a higher rate of marginal or losing trades. The strategy's single highest-impact rule is simply: stop trading when nobody has conviction.


Repository Structure

.
├── solutions.py              # Core processing script and strategy simulation
├── submission_results.csv    # Merged dataset with sentiment classifications
├── pnl_sentiment.png         # PnL distribution across sentiment categories
├── historical_data.csv       # (Required) Raw Hyperliquid trade records
├── fear_greed_index.csv      # (Required) Daily Fear & Greed Index data
└── README.md

Getting Started

Prerequisites

  • Python 3.8+
  • pandas, matplotlib, seaborn

Installation

pip install pandas matplotlib seaborn

Data Setup

Place the following files in the project root before running:

historical_data.csv
fear_greed_index.csv

Run

python solutions.py

The script will:

  1. Load and merge both data sources on normalized timestamps
  2. Classify each trade by its corresponding sentiment regime
  3. Compute baseline vs. strategy-filtered PnL statistics
  4. Output submission_results.csv and pnl_sentiment.png

Visualizations

pnl_sentiment.png — Distribution of average Closed PnL across each sentiment category, highlighting the performance gap between high-signal (Extreme Fear / Extreme Greed) and low-signal (Neutral) regimes.


Methodology

Step Detail
Data Merging Timestamp normalization to daily granularity via pandas; left-join on trade date
Sentiment Binning Fear & Greed Index mapped to 5 standard categories per Alternative.me classification
Baseline Mean Closed PnL across all 211K+ unfiltered trades
Strategy Filter Subset trades matching directional + sentiment criteria; exclude Neutral regime entirely
Evaluation Metric Mean Closed PnL per trade (strategy vs. baseline)

Future Work

  • Intraday sentiment granularity — Hourly Fear & Greed proxies (funding rates, CVD) for sub-daily filtering
  • Per-asset breakdown — Sentiment effectiveness may vary across BTC, ETH, and altcoin pairs
  • Position sizing overlay — Scale size proportionally to sentiment extremity, not just binary on/off
  • Backtested equity curve — Convert per-trade PnL lift into a time-series P&L curve with drawdown analysis
  • Live signal integration — API hook to Alternative.me for real-time regime classification

Disclaimer

This project is for research and educational purposes only. Past performance of any trading strategy does not guarantee future results. Nothing in this repository constitutes financial advice.

About

Quantitative analysis and strategy simulation correlating Bitcoin Fear & Greed indices with Hyperliquid trader performance. Features a 57% PnL optimization strategy.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages