Skip to content

Manjit-dev11/Analyse-Of-Trader-Performance-And-Market-Sentiment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Analysis of Trader Performance and Market Sentiment

This repository contains a data analysis pipeline investigating the relationship between trader performance (derived from trading history data on Hyperliquid) and broader cryptocurrency market sentiment (measured by the Bitcoin Fear and Greed Index).

Project Overview

The core objective of this project is to explore whether market sentiment (fear vs. greed) correlates with or influences:

  1. Trader Profitability (PnL): How average daily profits and losses vary under different sentiment classifications.
  2. Trading Activity & Volume: Whether extreme fear or greed leads to higher daily trading volumes and trade counts.
  3. Transaction Costs: How total daily transaction fees behave under various sentiment regimes.

Directory Structure

  • Analysis.ipynb: Main Jupyter notebook containing the data preprocessing, exploratory data analysis, correlation studies, and visualization.
  • historical_data.csv: A comprehensive log of historical trades, including price, size, side (BUY/SELL), timestamp, closed PnL, and fees.
  • fear_greed_index.csv: Historical daily records of the Bitcoin Fear and Greed Index, classifying days into categories like Extreme Fear, Fear, Greed, and Extreme Greed.
  • requirements.txt: Python package requirements.
  • read_notebook.py: A utility script to inspect Jupyter notebook cells.

Dataset Details

1. Trader Historical Data (historical_data.csv)

This dataset contains trade-level execution details for a trader's account. Key columns include:

Column Description Data Type
Account The trader's wallet address String (Hexadecimal)
Coin Token code or identifier String
Execution Price Execution price of the trade Float
Size Tokens Quantity of tokens traded Float
Size USD Transaction size in USD Float
Side Trade direction (BUY or SELL) String
Timestamp IST Trade execution time (IST, format: %d-%m-%Y %H:%M) String / Datetime
Closed PnL Realized profit and loss in USD (populated for closing trades) Float
Fee Transaction fees paid Float
Order ID Unique identifier for the order Integer

2. Bitcoin Fear and Greed Index (fear_greed_index.csv)

This dataset represents the daily market sentiment for Bitcoin. Key columns include:

Column Description Data Type
timestamp Unix timestamp of the index record Integer
value Sentiment score ranging from 0 (Extreme Fear) to 100 (Extreme Greed) Integer
classification Qualitative sentiment category (e.g., Fear, Extreme Fear, Greed, Extreme Greed) String
date Calendar date (format: YYYY-MM-DD) String / Datetime

Installation and Setup

Prerequisites

Make sure you have Python 3.8+ installed on your system.

Installing Dependencies

Install the required libraries listed in requirements.txt:

pip install -r requirements.txt

Running the Analysis

To view and execute the analysis pipeline:

  1. Start the Jupyter notebook server in the project directory:
    jupyter notebook
  2. Open Analysis.ipynb and run all cells.

Analysis Pipeline

1. Data Loading and Preprocessing

  • Type Conversion: Converts time columns to datetime objects. Converts string numeric values to proper floats/ints, coercing errors to NaN.
  • Daily Aggregation: Groups the detailed trade data from historical_data.csv by date to calculate:
    • total_pnl: Sum of realized profits/losses per day.
    • total_volume: Sum of size in USD per day.
    • total_trades: Count of trades executed per day.
    • total_fees: Sum of transaction fees paid per day.
  • Merging: Performs an inner join of the daily trading statistics and the daily Fear & Greed index using the date.

2. Exploratory Data Analysis (EDA)

  • Daily PnL by Sentiment: Generates a bar plot showing the average daily PnL across different sentiment classifications (e.g., Fear, Extreme Fear, Greed, Extreme Greed).
  • Daily Volume by Sentiment: Generates a bar plot illustrating average trading volume across different market sentiments.

3. Correlation Analysis

  • Computes a correlation matrix between total_pnl, total_volume, total_trades, total_fees, and the Fear & Greed index value.
  • Renders a Seaborn heatmap representing these correlations to identify linear relationships between sentiment score and trading metrics.

4. Key Findings & Insights

  • Trading Volume & Sentiment: Extreme market sentiment (extreme greed/fear) often corresponds to elevated volumes.
  • Profitability (PnL): Highlights whether trading profits increase during bullish sentiment (Greed) or defensive phases (Fear).
  • Correlation Strength: Indicates the level of linear dependency between sentiment metrics and fees or transaction counts.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors