# stockalgo/stolgo architecture

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

- Interactive diagram: https://gitdiagram.com/stockalgo/stolgo
- Repository: https://github.com/stockalgo/stolgo

## Overview

##### Project Type Analysis
This is an open-source Python library (stolgo) that provides APIs for Price Action Trading analysis. It's primarily a tool library that integrates with data sources and provides analytical capabilities.

##### Main Components

a. Data Layer:
- External Data Sources (show integration with bandl.io)
- Yahoo Finance
- NASDAQ
- Broker APIs
- Exchange websites

b. Core Library Components (based on lib/stolgo structure):
- Price Analysis Modules
- Candlestick Pattern Analysis (candlestick.py)
- Breakout Detection (breakout.py)
- Trend Analysis (trend.py)
- Data Management
- Request Handler (request.py)
- Common Utilities (common.py)
- Market-Specific Modules
- NASDAQ Integration (nasdaq.py)
- SAMCO Integration (samco.py)

**┌─────────────────────────────────────┐**
- Client Application        │
- ┘
- ↓
**┌─────────────────────────────────────┐**
- Stolgo Library API          │
- ┘
- ↓
**┌─────────────────────────────────────┐**
- Analysis Modules            │
- ┬────────────┬─────────┤
- Candlestick │  Breakout  │  Trend  │
- ┴────────────┴─────────┘
- ↓
**┌─────────────────────────────────────┐**
- Data Integration            │
- ┬────────────┬─────────┤
- bandl.io  │   Direct   │  APIs   │
- ┴────────────┴─────────┘

##### Important Elements to Highlight

a. Data Flow:
- How data flows from external sources through bandl.io
- How the data is processed through analysis modules
- Demonstrate the output flow to client applications

b. Module Interactions:
- Relationships between analysis modules
- Common utility usage across modules
- Error handling paths (exception.py)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef external fill:#FFA07A,stroke:#FF6347
    classDef core fill:#87CEEB,stroke:#4682B4
    classDef data fill:#98FB98,stroke:#3CB371
    classDef api fill:#DDA0DD,stroke:#9370DB
    classDef utility fill:#F0E68C,stroke:#DAA520

    %% Client Layer
    subgraph ClientLayer
        Client[Client Application]
    end

    %% Library API Layer
    subgraph LibraryAPI
        MainAPI["Stolgo Library API"]:::core
        ErrorHandler["Exception Handling"]:::utility
        Utils["Helper Utilities"]:::utility
    end

    %% Analysis Modules Layer
    subgraph AnalysisModules
        Candlestick["Candlestick Analysis"]:::core
        Breakout["Breakout Detection"]:::core
        Trend["Trend Analysis"]:::core
        Common["Common Utilities"]:::utility
    end

    %% Data Integration Layer
    subgraph DataIntegration
        RequestHandler["Request Handler"]:::data
        NASDAQ["NASDAQ Integration"]:::data
        SAMCO["SAMCO Integration"]:::data
    end

    %% External Data Sources
    subgraph ExternalSources
        Bandl["bandl.io"]:::external
        YahooFinance["Yahoo Finance"]:::external
        NASDAQExt["NASDAQ API"]:::external
        BrokerAPIs["Broker APIs"]:::external
    end

    %% Relationships
    Client --> MainAPI
    MainAPI --> ErrorHandler
    MainAPI --> Utils
    MainAPI --> Candlestick
    MainAPI --> Breakout
    MainAPI --> Trend
    
    Candlestick --> Common
    Breakout --> Common
    Trend --> Common
    
    Candlestick --> RequestHandler
    Breakout --> RequestHandler
    Trend --> RequestHandler
    
    RequestHandler --> NASDAQ
    RequestHandler --> SAMCO
    
    NASDAQ --> Bandl
    SAMCO --> Bandl
    
    Bandl --> YahooFinance
    Bandl --> NASDAQExt
    Bandl --> BrokerAPIs

    %% Click Events
    click Candlestick "https://github.com/stockalgo/stolgo/blob/master/lib/stolgo/candlestick.py"
    click Breakout "https://github.com/stockalgo/stolgo/blob/master/lib/stolgo/breakout.py"
    click Trend "https://github.com/stockalgo/stolgo/blob/master/lib/stolgo/trend.py"
    click RequestHandler "https://github.com/stockalgo/stolgo/blob/master/lib/stolgo/request.py"
    click Common "https://github.com/stockalgo/stolgo/blob/master/lib/stolgo/common.py"
    click NASDAQ "https://github.com/stockalgo/stolgo/blob/master/lib/stolgo/nasdaq.py"
    click SAMCO "https://github.com/stockalgo/stolgo/blob/master/lib/stolgo/samco.py"
    click ErrorHandler "https://github.com/stockalgo/stolgo/blob/master/lib/stolgo/exception.py"
    click Utils "https://github.com/stockalgo/stolgo/blob/master/lib/stolgo/helper.py"
    click MainAPI "https://github.com/stockalgo/stolgo/blob/master/lib/stolgo/__init__.py"

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["External Services"]:::external
        L3["Data Integration"]:::data
        L4["API Components"]:::api
        L5["Utility Modules"]:::utility
    end
```
