# savvibrax/smartmoneyconcepts-py architecture

> Architecture diagram of the GitHub repository savvibrax/smartmoneyconcepts-py, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/savvibrax/smartmoneyconcepts-py
- Repository: https://github.com/savvibrax/smartmoneyconcepts-py

## Overview

##### Main Components
- Library Package ("smartmoneyconcepts"): This is the core of the project. It contains the main module (SMC.py) that implements the various indicator functions.
- Data Input: Although the library itself does not handle data ingestion, it expects an OHLC or OHLCV DataFrame from an external source. Represent this as an “Input Data” component.
- Indicator Functions: Inside the SMC.py, functions for each indicator are defined. Consider breaking these out into separate “function blocks” if needed (FVG, highs_lows, bos_choch, ob, liquidity).
- Tests: The tests directory holds example CSV files and test scripts (e.g., SMC.test.py, SMC.test_binance.py) which validate the functionalities. This represents your “verification and usage examples” layer.
- Packaging & Distribution: Represent components relating to setup.py and metadata (egg-info) showing that it’s a pip-installable package.

##### Relationships and Interactions
- The “Input Data” component (data provider) sends the OHLC/OHLCV DataFrame into the library functions.
- The “Indicator Functions” process the data and output the calculated values or signals.
- The library is consumed by client code (end-user code that imports the package as shown in the usage documentation) and tested through unit tests.
- The tests component simulates various inputs (using CSV data), invokes the library functions, and validates outcomes, ensuring the reliability of the indicator calculations.

##### Architectural Patterns and Design Principles
- Modularity: The design follows a modular structure where the main business logic is encapsulated within the “smartmoneyconcepts” package.
- Separation of Concerns: Indicator functions are clearly separated from data input and test components, which helps maintain clarity and eases future enhancements or contributions.
- Extensibility: The README mentions that new indicators can be added, so the architecture should be depicted to allow additional indicator modules or functions within the central package.

##### Relevant Technologies & Libraries
- Python: The core programming language.
- Pandas (implied): Used for managing OHLC/OHLCV DataFrames.
- External Code Quality Tools: Mention of the black code formatter in the contribution guidelines.
- Testing Framework: Implied unit testing framework for the files in the tests directory (e.g., pytest or unittest).

##### Elements
- A connection from the module to the “Client Code / Application Layer” that imports and uses the functions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Components
    CA["Client Application / User Code"]:::client
    ID["OHLC/OHLCV Data"]:::input

    %% Smart Money Concepts Library
    subgraph "Smart Money Concepts Library"
        SM["SMC Module"]:::library
        MI["Module Init"]:::library
        subgraph "Indicator Functions"
            FVG["FVG"]:::indicator
            HL["Highs and Lows"]:::indicator
            BC["BOS/CHoCH"]:::indicator
            OB["OB"]:::indicator
            LIQ["Liquidity"]:::indicator
        end
    end

    %% Tests and Verification
    subgraph "Tests and Verification"
        T1["SMC.test.py"]:::test
        T2["SMC.test_binance.py"]:::test
        CSV1["EURUSD_15M CSV"]:::data
        CSV2["bittrex_btc-usdt CSV"]:::data
    end

    %% Packaging & Distribution
    subgraph "Packaging & Distribution"
        SET["setup.py"]:::packaging
        EGG["egg-info"]:::packaging
    end

    %% Data Flow
    CA -->|"imports"| SM
    ID -->|"providesData"| SM
    SM --> FVG
    SM --> HL
    SM --> BC
    SM --> OB
    SM --> LIQ
    T1 -->|"testsModule"| SM
    T2 -->|"testsModule"| SM
    CSV1 -->|"usedForTests"| T1
    CSV2 -->|"usedForTests"| T2
    SM -->|"packagedIn"| SET
    SET -->|"metadata"| EGG

    %% Click Events
    click SM "https://github.com/savvibrax/smartmoneyconcepts-py/blob/master/smartmoneyconcepts/SMC.py"
    click MI "https://github.com/savvibrax/smartmoneyconcepts-py/blob/master/smartmoneyconcepts/__init__.py"
    click FVG "https://github.com/savvibrax/smartmoneyconcepts-py/blob/master/smartmoneyconcepts/SMC.py"
    click HL "https://github.com/savvibrax/smartmoneyconcepts-py/blob/master/smartmoneyconcepts/SMC.py"
    click BC "https://github.com/savvibrax/smartmoneyconcepts-py/blob/master/smartmoneyconcepts/SMC.py"
    click OB "https://github.com/savvibrax/smartmoneyconcepts-py/blob/master/smartmoneyconcepts/SMC.py"
    click LIQ "https://github.com/savvibrax/smartmoneyconcepts-py/blob/master/smartmoneyconcepts/SMC.py"
    click T1 "https://github.com/savvibrax/smartmoneyconcepts-py/blob/master/tests/SMC.test.py"
    click T2 "https://github.com/savvibrax/smartmoneyconcepts-py/blob/master/tests/SMC.test_binance.py"
    click CSV1 "https://github.com/savvibrax/smartmoneyconcepts-py/blob/master/tests/EURUSD_15M.csv"
    click CSV2 "https://github.com/savvibrax/smartmoneyconcepts-py/blob/master/tests/bittrex_btc-usdt.csv"
    click SET "https://github.com/savvibrax/smartmoneyconcepts-py/blob/master/setup.py"
    click EGG "https://github.com/savvibrax/smartmoneyconcepts-py/blob/master/smartmoneyconcepts.egg-info"

    %% Styles
    classDef client fill:#fce4ec,stroke:#c2185b,stroke-width:2px;
    classDef input fill:#e3f2fd,stroke:#1976d2,stroke-width:2px;
    classDef library fill:#e8f5e9,stroke:#388e3c,stroke-width:2px;
    classDef indicator fill:#fff3e0,stroke:#f57c00,stroke-width:2px;
    classDef test fill:#e0f7fa,stroke:#0097a7,stroke-width:2px;
    classDef packaging fill:#f3e5f5,stroke:#8e24aa,stroke-width:2px;
    classDef data fill:#fffde7,stroke:#f9a825,stroke-width:2px;
```
