Skip to content

Repository files navigation

Community Detection in Financial Networks Using Stochastic Block Model

Community detection in Trade Data

Overview

This project analyzes international trade relationships using network analysis and community detection algorithms to identify trading blocs and patterns.

The code implements:

  • Country name standardization between different data sources
  • Network analysis of international trade relationships
  • Community detection using the Weighted Stochastic Block Model (WSBM)
  • Visualization of trade communities and network structure

image communities generated for n blocks = 16

image communities generated for n blocks = 12

Community Detection in Indian Stock Data ( NIFTY 150 )

Overview

This project analyzes the relationships between stocks in India's NIFTY 150 index using network analysis and community detection techniques. The analysis includes correlation-based edge weights and identifies trading communities using the Weighted Stochastic Block Model (WSBM).

Key Features

  • Correlation network construction from stock price data
  • Community detection using WSBM
  • Interactive network visualization
  • Hierarchical clustering analysis

Data Processing

  1. Data Collection

    • Stock data for NIFTY 150 companies from yfinance
    • Cleaning and preprocessing time series data
    • Computing pairwise correlations
  2. Network Construction

    • Edge weights based on stock price correlations
    • Threshold filtering for significant relationships
    • Network normalization techniques
  3. Community Detection

    • Implementation of WSBM algorithm
    • Parameter optimization for community detection
    • Validation of community structures

Visualizations

  1. Network Graph

    • Color-coded communities
    • Edge weights showing correlation strength
    • Interactive spring layout
    • Node labels for stock identification
  2. Hierarchical Clustering

    • Dendrogram visualization
    • Distance-based clustering
    • Community relationship analysis

image Dendogram for communities obtained

image graph of communities visualized

We can see it is able to correctly identify various sectors in NIFTY as communities.

Contributions

Contribution Contributors
Research and Ideation Ishaq
Data Sourcing Rohit, Ishaq
Trade Database Construction Nagasai
Data Engineering Nagasai, Shankar
Community Generation Code Rohit, Sathvik
Stock Communities Visualization Sathvik, Rohit, Nagasai
Trade Communities Visualization Rohit
Inference Ishaq

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages