# vedaaaaaaant/pj_orb_backtester architecture

> Architecture diagram of the GitHub repository vedaaaaaaant/pj_orb_backtester, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vedaaaaaaant/pj_orb_backtester
- Repository: https://github.com/vedaaaaaaant/pj_orb_backtester

## Overview

##### Main Components

a. External Systems:
- Zerodha KiteConnect API
- Zerodha Historical Data API

b. Core Components:
- API Initialization Module (represented by init_api-dummy.py)
- Backtester Engine (represented by orb_backtester.py)
- Configuration Layer (for user inputs/parameters)

##### Data Flow and Interactions

- [Zerodha APIs] ←→ [API Initialization Module] → [Backtester Engine]
- ↑
- [Configuration Layer]

##### Component Details

a. Configuration Layer (Bottom):
- Stock List (tPF)
- Date Range (stockyear, stockMonth, endMonth)
- Trading Parameters (mta, ord, profitTarget, stoplossTarget)

b. API Initialization Module (Left):
- Authentication and connection management
- Connection to Zerodha's APIs

c. Backtester Engine (Center):
- Subcomponents:
- Data Fetcher
- Strategy Processor
- Results Calculator

##### Additional Elements
- Version/date information
- Performance-related metrics or limitations

Key Technical Details to Highlight:
- Authentication flow with Zerodha
- Historical data retrieval process
- Strategy execution pipeline
- Results calculation and output format

Remember to include a note about the system's limitations, particularly regarding:
- Current month calculations
- Indian stocks only
- Zerodha API dependencies

## Diagram (Mermaid)

```mermaid
graph TB
    %% External Systems
    subgraph External["External Systems"]
        ZK[Zerodha KiteConnect API]:::external
        ZH[Zerodha Historical Data API]:::external
    end

    %% API Initialization
    subgraph Init["API Initialization"]
        API[API Initialization Module]:::core
        Auth[Authentication Manager]:::core
    end

    %% Backtester Engine
    subgraph Engine["Backtester Engine"]
        BE[Backtester Core]:::core
        DF[Data Fetcher]:::core
        SP[Strategy Processor]:::core
        RC[Results Calculator]:::core
    end

    %% Configuration Layer
    subgraph Config["Configuration Layer"]
        SL[Stock List]:::config
        DR[Date Range]:::config
        TP[Trading Parameters]:::config
    end

    %% Connections
    ZK <--> API
    ZH <--> API
    API --> Auth
    Auth --> BE
    BE --> DF
    DF --> SP
    SP --> RC
    
    SL -.-> BE
    DR -.-> BE
    TP -.-> BE

    %% Notes
    classDef external fill:#3498db
    classDef core fill:#2ecc71
    classDef config fill:#f1c40f
    
    %% Click Events
    click API "https://github.com/vedaaaaaaant/pj_orb_backtester/blob/master/init_api-dummy.py"
    click BE "https://github.com/vedaaaaaaant/pj_orb_backtester/blob/master/orb_backtester.py"

    %% System Notes
    subgraph Notes["System Limitations"]
        N1[Current Month Calculations]:::note
        N2[Indian Stocks Only]:::note
        N3[Zerodha API Dependencies]:::note
    end
    
    classDef note fill:#e74c3c,color:#fff

    %% Legend
    subgraph Legend
        L1[External Systems]:::external
        L2[Core Components]:::core
        L3[Configuration]:::config
        L4[Limitations]:::note
    end
```
