Skip to content

Explorer1905/trader-sentiment-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Trader Performance vs Market Sentiment Analysis

This project analyzes the relationship between Bitcoin market sentiment (Fear vs Greed) and trader behavior and performance on Hyperliquid.

The objective is to identify patterns that could help design better trading strategies based on market sentiment.

This work was completed as part of the Data Science / Analytics Intern – Round 0 Assignment for Primetrade.ai.


Project Structure

Trader-Sentiment-Analysis

trader_sentiment_analysis.ipynb → Data analysis notebook
dashboard.py → Streamlit dashboard
processed_trader_sentiment_data.csv → Cleaned merged dataset
fear_greed_index.csv → Market sentiment dataset
historical_trader_data.csv → Hyperliquid trading dataset
requirements.txt → Python dependencies
README.md → Project documentation


Datasets

1. Bitcoin Market Sentiment (Fear/Greed)

Columns:

  • Date
  • Classification (Fear / Greed)

This dataset represents the overall Bitcoin market sentiment for each day.


2. Historical Trader Data (Hyperliquid)

Fields include:

  • account
  • symbol
  • execution price
  • size
  • side
  • time
  • leverage
  • closedPnL

This dataset represents historical trading activity on Hyperliquid.


Data Preparation

Steps performed during preprocessing:

  1. Loaded both datasets using pandas
  2. Checked dataset shape (rows and columns)
  3. Checked for missing values and duplicates
  4. Converted timestamps to datetime format
  5. Extracted date values from trade timestamps
  6. Aggregated trading data to daily level
  7. Merged trader dataset with sentiment dataset using the Date column

Key Metrics Created

The following metrics were calculated to analyze trader behavior:

  • Daily PnL
  • Win rate
  • Average trade size
  • Leverage distribution
  • Number of trades per day
  • Long/Short ratio

These metrics help evaluate both trader performance and behavior patterns.


Analysis Questions

The analysis focuses on answering the following questions:

  1. Does trader performance differ between Fear vs Greed days?
  2. Do traders change behavior based on market sentiment?
  3. Can traders be segmented into meaningful behavioral groups?

Trader Segmentation

Traders were segmented into behavioral groups such as:

  • High leverage vs Low leverage traders
  • Frequent vs Infrequent traders
  • Consistent vs Inconsistent performers

These segments were analyzed across different sentiment conditions to understand how behavior changes with market sentiment.


Key Insights

Insight 1 — Increased Risk During Greed Periods

During Greed sentiment, traders tend to:

  • Increase leverage
  • Trade more frequently
  • Open larger position sizes

However, this behavior also increases PnL volatility and potential losses.


Insight 2 — Conservative Behavior During Fear

During Fear sentiment, traders tend to:

  • Reduce leverage
  • Open smaller positions
  • Trade less frequently

This indicates risk-averse behavior during uncertain markets.


Insight 3 — High Leverage Leads to Volatile Returns

High-leverage traders show:

  • Larger swings in PnL
  • Higher risk exposure
  • Less consistent profitability

This highlights the importance of risk management strategies.


Strategy Recommendations

Strategy 1 — Reduce Leverage During Fear

During Fear sentiment:

  • Reduce leverage exposure
  • Trade smaller position sizes
  • Focus on capital preservation

This helps reduce risk during uncertain market conditions.


Strategy 2 — Controlled Aggression During Greed

During Greed sentiment:

  • Trade frequency can increase moderately
  • Opportunities may be higher
  • However leverage should remain controlled

The goal is to capture opportunities without excessive risk.


Dataset Download

Due to GitHub file size limits, the datasets are not included in the repository.

Download them here:

Bitcoin Fear/Greed Dataset
https://drive.google.com/file/d/1PgQC0tO8XN-wqkNyghWc_-mnrYv_nhSf/view

Historical Trader Data
https://drive.google.com/file/d/1IAfLZwu6rJzyWKgBToqwSmmVYU6VbjVs/view

Dashboard

A lightweight interactive dashboard was built using Streamlit to explore:

  • Market sentiment distribution
  • PnL performance trends
  • Leverage patterns
  • Trade frequency
  • Trader behavior metrics

Run the dashboard locally using:

streamlit run dashboard.py

Setup Instructions

Clone the repository:

git clone https://github.com/explorer1905/trader-sentiment-analysis.git

Navigate to the project folder:

cd trader-sentiment-analysis

Install dependencies:

pip install -r requirements.txt

Run the analysis notebook:

jupyter notebook trader_sentiment_analysis.ipynb

Run the dashboard:

streamlit run dashboard.py

Technologies Used

  • Python
  • pandas
  • numpy
  • matplotlib
  • seaborn
  • Streamlit
  • scikit-learn

Author

Shravani Chavan

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors