# disciplined-pioneer/crypto-market-screeners architecture

> Architecture diagram of the GitHub repository disciplined-pioneer/crypto-market-screeners, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/disciplined-pioneer/crypto-market-screeners
- Repository: https://github.com/disciplined-pioneer/crypto-market-screeners

## Overview

##### Main Components
- Data Sources:
- External Market Data: The project uses live cryptocurrency data (e.g., via the Binance API) – see data_processing.py.
- Preprocessed Data Files: The project reads sentiment CSV files stored under data/Sentiment and volatility outputs.
- Data Processing:
- data_processing.py is responsible for retrieving and formatting raw market data including price, volume, delta, and open interest.
- Analysis / Screener Modules (each represented as its own component):
- ATR Screener (atr_screener.py): Calculates and outputs market volatility (written to data/ATR/volatility_results.json).
- Isolation Forest Screener (isol_forest_screener.py): Detects volume and price anomalies using the Isolation Forest algorithm.
- Market Ratio Screener (market_ratio.py): Computes various market metrics to detect supply and demand imbalances.
- Sentiment Screener (sentiment.py): Processes CSV files from data/Sentiment and computes market sentiment.
- Volume Spikes Screener (volume_spikes.py): Identifies significant trading volume spikes.
- Data Repository:
- The “data” directory holds the output/intermediate results from various screeners.

##### Relationships and Interactions
- Data flows from external sources (e.g., Binance API, CSV files) into the Data Processing component.
- The standardized or processed data is then fed as input into each screener module.
- Each analysis module (ATR, Isolation Forest, etc.) produces outputs that are saved back to the “data” directory or reported via logs/visualizations.
- There is an implied dependency where the data_processing module is the initial step, supplying data for most other analyses.

##### Architectural Patterns / Design Principles
- Modular Design: Each Python script represents a separate module focused on a specific analysis, promoting single responsibility.
- Pipeline Flow: There is a data ingestion and processing phase that feeds different analysis pipelines.
- Separation of Concerns: Data gathering, processing, and analysis are implemented as distinct components, allowing you to upgrade or adjust one part without affecting others.

##### Mention the Relevant Technologies and Frameworks
- Python 3.8+ and libraries mentioned in requirements.txt (e.g., scikit-learn for Isolation Forest, seaborn for visualization).
- File-based data persistence (JSON and CSV) and data processing using custom modules.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Sources Layer
    subgraph "Data Sources"
        extAPI("Binance API"):::external
        sentCSV("Preprocessed Sentiment Data"):::external
    end

    %% Data Processing Layer
    subgraph "Processing Layer"
        dp("Data Processing"):::processing
    end

    %% Screener Modules Layer
    subgraph "Screener Modules"
        atr("ATR Screener"):::screener
        isol("Isolation Forest Screener"):::screener
        mr("Market Ratio Screener"):::screener
        vol("Volume Spikes Screener"):::screener
        sent("Sentiment Screener"):::screener
    end

    %% Output Layer
    subgraph "Output Layer"
        atrOut("Data/ATR"):::repo
        repo("Data Repository"):::repo
    end

    %% Connections - Data Ingestion and Processing Pipelines
    extAPI -->|"FetchesMarketData"| dp
    dp -->|"ProcessedData"| atr
    dp -->|"ProcessedData"| isol
    dp -->|"ProcessedData"| mr
    dp -->|"ProcessedData"| vol
    sentCSV -->|"CSVInputs"| sent

    %% Connections - Screener Output to Data Storage
    atr -->|"VolatilityMetrics"| atrOut
    isol -->|"AnomalyResults"| repo
    mr -->|"MarketRatios"| repo
    vol -->|"VolumeSpikes"| repo
    sent -->|"SentimentAnalysis"| repo

    %% Click Events
    click extAPI "https://github.com/disciplined-pioneer/crypto-market-screeners/blob/main/data_processing.py"
    click sentCSV "https://github.com/disciplined-pioneer/crypto-market-screeners/tree/main/data/Sentiment"
    click dp "https://github.com/disciplined-pioneer/crypto-market-screeners/blob/main/data_processing.py"
    click atr "https://github.com/disciplined-pioneer/crypto-market-screeners/blob/main/atr_screener.py"
    click isol "https://github.com/disciplined-pioneer/crypto-market-screeners/blob/main/isol_forest_screener.py"
    click mr "https://github.com/disciplined-pioneer/crypto-market-screeners/blob/main/market_ratio.py"
    click sent "https://github.com/disciplined-pioneer/crypto-market-screeners/blob/main/sentiment.py"
    click vol "https://github.com/disciplined-pioneer/crypto-market-screeners/blob/main/volume_spikes.py"
    click atrOut "https://github.com/disciplined-pioneer/crypto-market-screeners/tree/main/data/ATR"
    click repo "https://github.com/disciplined-pioneer/crypto-market-screeners/tree/main/data"

    %% Styles
    classDef external fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef processing fill:#FFA07A,stroke:#000,stroke-width:1px;
    classDef screener fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef repo fill:#FFFF99,stroke:#000,stroke-width:1px;
```
