Skip to content

ayushraj61/Trade-Behavior-Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📊 Trader Behavior Insights: An Analysis of Performance vs. Market Sentiment

This project analyzes historical trader data from Hyperliquid and the Bitcoin Fear & Greed Index to explore how trader behavior aligns with market sentiment. The goal is to uncover actionable patterns that can lead to smarter, data-driven trading strategies.


🧠 Methodology

🔹 Data Loading

  • Two primary datasets were used:
    • Hyperliquid trader data (PnL, leverage, side, execution details, etc.)
    • Bitcoin Fear & Greed Index (daily sentiment classification and scores)

🔹 Data Preprocessing

  • Dates were standardized to daily granularity to enable accurate merging.
  • The Timestamp IST field in the trader dataset was converted to date-only format.
  • Both datasets were merged using this date field as a key.
  • Numerical fields like Closed PnL and Fee were cleaned and converted to appropriate types.

📊 Analysis & Visualizations

📈 1. Fear & Greed Index Over Time

  • Visualization: Line chart of the sentiment score over time.
  • Insight: Shows how market emotions evolved over the observed period. Peaks and dips indicate shifts in market psychology.

🎨 2. Sentiment Classifications Over Time

  • Visualization: Scatterplot of sentiment scores color-coded by classification.
  • Insight: Highlights distinct sentiment phases and their frequency over time.

📊 3. Distribution of Sentiment Classifications

  • Visualization: Bar chart showing the count of each sentiment type.
  • Insight: Fear and Extreme Fear dominate the dataset, indicating a market frequently in pessimistic phases.

💹 4. Average Trader PnL by Market Sentiment

  • Visualization: Bar chart of average Closed PnL by sentiment classification.
  • Insight:
    • Traders tend to perform better during 'Fear' and 'Extreme Fear'.
    • Performance significantly drops during Greed phases.

💸 5. Average Fee Paid by Sentiment

  • Visualization: Bar chart of average trading fees by sentiment.
  • Insight:
    • Higher fees are observed during Greed and Extreme Greed, indicating increased trading activity and possibly emotional, FOMO-driven trades.

🟢🔴 6. Buy vs. Sell: Average PnL by Sentiment

  • Visualization: Grouped bar chart comparing Buy vs. Sell performance across sentiments.
  • Insight:
    • Buy orders during Fear are consistently profitable.
    • Sell orders during Greed outperform buy orders.
    • Validates a contrarian strategy: "Buy the Fear, Sell the Greed."

📈 7. Trader Activity by Market Sentiment

  • Visualization: Bar chart of the number of trades executed under each sentiment.
  • Insight:
    • Trading activity spikes during both Extreme Fear and Extreme Greed.
    • Traders are most active during emotional extremes, often when markets are most volatile.

🧐 Insights Summary

  • Traders tend to perform better on average during Fear periods, especially with Buy orders.
  • Fees and risk appetite increase significantly during Greed, indicating heightened emotional trading.
  • A Contrarian Strategy (Buy during Fear, Sell during Greed) statistically yields better performance.
  • Trader activity clusters around emotional extremes, where market participants are most active and potentially most vulnerable.

This analysis demonstrates that market psychology directly affects trader behavior and profitability. Incorporating sentiment-aware strategies can significantly improve risk-adjusted returns.


🧭 Strategic Recommendations

  • Contrarian Signal Model: Focus on buying in "Extreme Fear" and taking profits or short positions in "Extreme Greed."
  • Dynamic Leverage Management: Advise traders to reduce leverage in greedy markets to minimize exposure.
  • Trader Education: Use sentiment-driven insights to help traders avoid FOMO and emotional decision-making.

📁 Project Files

  • historical_trader_data.csv – Raw trader data
  • fear_greed_index.csv – Bitcoin sentiment data
  • trader_sentiment_analysis_full.ipynb – Full analysis notebook
  • visual_1_fear_greed_over_time.png
  • visual_2_sentiment_classifications.png
  • visual_3_sentiment_distribution.png
  • visual_4_avg_pnl_by_sentiment.png
  • visual_5_trader_activity_by_sentiment.png 📄 Download Full Analysis Report (PDF)

👨‍💻 Author

Ayush Raj
Data Science Project: Trader Behavior and Market Sentiment


Thank you for reviewing my project! I look forward to the opportunity to discuss it further.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages