Coder Social home page Coder Social logo

etfgraph's Introduction

ETFGraph

ETFGraph is a comprehensive analytics tool for creating and analyzing an attributed graph of exchange traded funds (ETFs) and their underlying assets. It utilizes financial data to aid investors, analysts, and researchers in exploring complex relationships between ETFs and their components, identifying influential stocks, and understanding market dynamics through community structures and centrality metrics.

Features

  • Data Pull and Graph Generation: Automatically retrieves data on ETFs and their holdings from the Financial Modeling Prep API, constructing a graph representation.
  • Graph Visualization: Provides visual representation of the ETF graph to facilitate understanding of connections and clusters.
  • Community Detection and Clustering: Employs algorithms like the Louvain method to detect communities, identifying potential market segments.
  • Centrality and PageRank Analysis: Computes centrality measures and PageRank to spotlight influential stocks within ETFs.
  • Link Analysis: Investigates relationships between ETFs and stocks based on attributes such as weight and multiple ETF inclusions.
  • Detailed Community Analysis: Focuses on the largest communities to pinpoint the top stocks based on their connectivity weights.
  • Graph Serialization: Offers capabilities to save the graph to a file for subsequent analysis or transfer using serialization formats like pickle.

Requirements

ETFGraph requires a Financial Modeling Prep API key to access financial data for ETFs and their underlying assets. Obtain your API key by signing up for a free account at Financial Modeling Prep.

Environment Setup

Before running ETFGraph, ensure you have a .env file in the root directory of the project with the following content:

FMPKey=your_financial_modeling_prep_api_key_here

Installation

To set up ETFGraph, clone the repository and install the required Python packages:

git clone https://github.com/bcdannyboy/ETFGraph/
cd ETFGraph
python3 -m pip install -r requirements.txt

Usage

Basic Usage

To run the tool and perform a basic analysis on all ETFs available in the Financial Modeling Prep API, execute the following command:

python3 main.py

Advanced Usage

Advanced Usage You can specify various options through command-line arguments:

  • -n, --num <int>: Specify the number of ETFs to analyze.
  • -d, --display: Enable graph visualization.
  • -r, --rate_limit <int>: Set the API request rate limit (default 150/minute).
  • -o, --output <path>: Save the results of the analysis to a JSON file.
  • -s, --save_graph <path>: Save the graph object for later use or analysis in pickle format.
  • -l --load_graph <path>: Load a saved graph object from a pickle file.

Examples:

To analyze 50 ETFs, display the graph, set the rate limit to 200 requests per minute, and save the results to a JSON file and graph object, use the following command:

python main.py -n 50 -d -r 200 -o output.json -s graph.pkl

To load a saved graph object and analyze the data without fetching new information, run:

python main.py -l graph.pkl

To analyze 100 ETFs at the default rate limit with only console output, execute:

python main.py -n 100

Roadmap

  • Pull Data & Generate Graph
  • Graph Visualization
  • Basic Community Detection / Clustering
  • Basic Centrality Analysis
  • PageRank Analysis
  • Basic Link Analysis
  • Overlapping community detection
  • Community modularity analysis
  • Better leveraged / inverse indication
  • Better bull / bear indication
  • Deep community analysis
  • Graph structure sparcification
  • Community asset correlation
  • Price simulation / price calculation as part of graph weights
  • Better Data Visualization

Contribute

Contributers welcome

etfgraph's People

Contributors

bcdannyboy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.