# rochi88/bdshare architecture

> Architecture diagram of the GitHub repository rochi88/bdshare, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rochi88/bdshare
- Repository: https://github.com/rochi88/bdshare

## Overview

bdshare is a Python client library for retrieving Dhaka Stock Exchange live and historical data, market information, and news, with caching, retries, and rate limiting. The main workflow is a user calling the public API, which dispatches to trading, market, or news functions; those fetch and normalize DSE data for analysis or storage. The graph also preserves documented indicators, portfolio tracking, streaming, and MCP capabilities. Some of these modules are unsampled, so their internal links are omitted where source evidence is unavailable.

Main entry points: [`bdshare/__init__.py`](https://github.com/rochi88/bdshare/blob/main/bdshare/__init__.py) (Public API and Client), [`bdshare/stock/trading.py`](https://github.com/rochi88/bdshare/blob/main/bdshare/stock/trading.py) (Trading and History), [`bdshare/stock/market.py`](https://github.com/rochi88/bdshare/blob/main/bdshare/stock/market.py) (Market Data), [`bdshare/stock/news.py`](https://github.com/rochi88/bdshare/blob/main/bdshare/stock/news.py) (News and Announcements)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Public API"]
  node_public_api["Public API and Client<br/>[__init__.py]"]
end

subgraph group_data["DSE Data"]
  node_trading["Trading and History<br/>[trading.py]"]
  node_market["Market Data<br/>[market.py]"]
  node_news["News and Announcements<br/>[news.py]"]
end

subgraph group_runtime["Runtime Support"]
  node_http_helpers["HTTP and Parsing<br/>[helper.py]"]
  node_source_config["Source Configuration<br/>[vars.py]"]
  node_cache[("TTL Cache<br/>[cache.py]")]
  node_session["Session and Token<br/>[session.py]"]
  node_tickers["Ticker Lookup<br/>[tickers.py]"]
  node_proxy["Proxy Setup<br/>[proxy.py]"]
  node_store["Data Export<br/>[store.py]"]
end

subgraph group_analysis["Analysis and Integrations"]
  node_indicators["Technical Indicators<br/>[indicators.py]"]
  node_portfolio["Portfolio Tracking<br/>[portfolio.py]"]
  node_stream["WebSocket Streaming<br/>[stream.py]"]
  node_mcp["MCP Server<br/>[mcp_server.py]"]
end

node_user(("Library User"))
node_dse{{"DSE Sites and API"}}

node_user -->|"calls"| node_public_api
node_public_api -->|"dispatches"| node_trading
node_public_api -->|"dispatches"| node_market
node_public_api -->|"dispatches"| node_news
node_trading -->|"fetches prices"| node_dse
node_market -->|"fetches market data"| node_dse
node_news -->|"fetches news"| node_dse
node_trading -->|"uses requests"| node_http_helpers
node_market -->|"uses requests"| node_http_helpers
node_news -->|"uses requests"| node_http_helpers
node_http_helpers -->|"reads endpoints"| node_source_config
node_trading -->|"selects source"| node_source_config
node_market -->|"selects source"| node_source_config
node_news -->|"selects source"| node_source_config
node_public_api -->|"caches responses"| node_cache
node_public_api -->|"manages session"| node_session
node_tickers -->|"fetches symbols"| node_trading
node_public_api -->|"exports data"| node_store
node_public_api -->|"offers indicators"| node_indicators
node_public_api -->|"offers tracking"| node_portfolio
node_trading -->|"supplies live data"| node_stream
node_public_api -->|"exposes tools"| node_mcp
node_public_api -->|"configures proxy"| node_proxy

click node_public_api "https://github.com/rochi88/bdshare/blob/main/bdshare/__init__.py"
click node_trading "https://github.com/rochi88/bdshare/blob/main/bdshare/stock/trading.py"
click node_market "https://github.com/rochi88/bdshare/blob/main/bdshare/stock/market.py"
click node_news "https://github.com/rochi88/bdshare/blob/main/bdshare/stock/news.py"
click node_http_helpers "https://github.com/rochi88/bdshare/blob/main/bdshare/util/helper.py"
click node_source_config "https://github.com/rochi88/bdshare/blob/main/bdshare/util/vars.py"
click node_cache "https://github.com/rochi88/bdshare/blob/main/bdshare/util/cache.py"
click node_session "https://github.com/rochi88/bdshare/blob/main/bdshare/util/session.py"
click node_tickers "https://github.com/rochi88/bdshare/blob/main/bdshare/util/tickers.py"
click node_proxy "https://github.com/rochi88/bdshare/blob/main/bdshare/util/proxy.py"
click node_store "https://github.com/rochi88/bdshare/blob/main/bdshare/util/store.py"
click node_indicators "https://github.com/rochi88/bdshare/blob/main/bdshare/indicators.py"
click node_portfolio "https://github.com/rochi88/bdshare/blob/main/bdshare/portfolio.py"
click node_stream "https://github.com/rochi88/bdshare/blob/main/bdshare/stream.py"
click node_mcp "https://github.com/rochi88/bdshare/blob/main/bdshare/mcp_server.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_public_api,node_user toneBlue
class node_trading,node_market,node_news toneAmber
class node_http_helpers,node_source_config,node_cache,node_session,node_tickers,node_proxy,node_store,node_dse toneMint
class node_indicators,node_portfolio,node_stream,node_mcp toneRose
```

## Components

### Public API

- [Public API and Client](https://github.com/rochi88/bdshare/blob/main/bdshare/__init__.py): `bdshare/__init__.py`

### DSE Data

- [Trading and History](https://github.com/rochi88/bdshare/blob/main/bdshare/stock/trading.py): `bdshare/stock/trading.py`
- [Market Data](https://github.com/rochi88/bdshare/blob/main/bdshare/stock/market.py): `bdshare/stock/market.py`
- [News and Announcements](https://github.com/rochi88/bdshare/blob/main/bdshare/stock/news.py): `bdshare/stock/news.py`

### Runtime Support

- [HTTP and Parsing](https://github.com/rochi88/bdshare/blob/main/bdshare/util/helper.py): `bdshare/util/helper.py`
- [Source Configuration](https://github.com/rochi88/bdshare/blob/main/bdshare/util/vars.py): `bdshare/util/vars.py`
- [TTL Cache](https://github.com/rochi88/bdshare/blob/main/bdshare/util/cache.py): `bdshare/util/cache.py`
- [Session and Token](https://github.com/rochi88/bdshare/blob/main/bdshare/util/session.py): `bdshare/util/session.py`
- [Ticker Lookup](https://github.com/rochi88/bdshare/blob/main/bdshare/util/tickers.py): `bdshare/util/tickers.py`
- [Proxy Setup](https://github.com/rochi88/bdshare/blob/main/bdshare/util/proxy.py): `bdshare/util/proxy.py`
- [Data Export](https://github.com/rochi88/bdshare/blob/main/bdshare/util/store.py): `bdshare/util/store.py`

### Analysis and Integrations

- [Technical Indicators](https://github.com/rochi88/bdshare/blob/main/bdshare/indicators.py): `bdshare/indicators.py`
- [Portfolio Tracking](https://github.com/rochi88/bdshare/blob/main/bdshare/portfolio.py): `bdshare/portfolio.py`
- [WebSocket Streaming](https://github.com/rochi88/bdshare/blob/main/bdshare/stream.py): `bdshare/stream.py`
- [MCP Server](https://github.com/rochi88/bdshare/blob/main/bdshare/mcp_server.py): `bdshare/mcp_server.py`

### Other components

- **Library User**
- **DSE Sites and API**

## Connections

- Library User → Public API and Client: calls (evidence: `README.md`)
- Public API and Client → Trading and History: dispatches (evidence: `bdshare/__init__.py`)
- Public API and Client → Market Data: dispatches (evidence: `bdshare/__init__.py`)
- Public API and Client → News and Announcements: dispatches (evidence: `bdshare/__init__.py`)
- Trading and History → DSE Sites and API: fetches prices (evidence: `bdshare/stock/trading.py`)
- Market Data → DSE Sites and API: fetches market data (evidence: `bdshare/stock/market.py`)
- News and Announcements → DSE Sites and API: fetches news (evidence: `bdshare/stock/news.py`)
- Trading and History → HTTP and Parsing: uses requests (evidence: `bdshare/stock/trading.py`)
- Market Data → HTTP and Parsing: uses requests (evidence: `bdshare/stock/market.py`)
- News and Announcements → HTTP and Parsing: uses requests (evidence: `bdshare/stock/news.py`)
- HTTP and Parsing → Source Configuration: reads endpoints (evidence: `bdshare/util/helper.py`)
- Trading and History → Source Configuration: selects source (evidence: `bdshare/stock/trading.py`)
- Market Data → Source Configuration: selects source (evidence: `bdshare/stock/market.py`)
- News and Announcements → Source Configuration: selects source (evidence: `bdshare/stock/news.py`)
- Public API and Client → TTL Cache: caches responses (evidence: `bdshare/__init__.py`)
- Public API and Client → Session and Token: manages session (evidence: `bdshare/__init__.py`)
- Ticker Lookup → Trading and History: fetches symbols (evidence: `bdshare/util/tickers.py`)
- Public API and Client → Data Export: exports data (evidence: `README.md`)
- Public API and Client → Technical Indicators: offers indicators (evidence: `README.md`)
- Public API and Client → Portfolio Tracking: offers tracking (evidence: `README.md`)
- Trading and History → WebSocket Streaming: supplies live data (evidence: `bdshare/stream.py`)
- Public API and Client → MCP Server: exposes tools (evidence: `bdshare/mcp_server.py`)
- Public API and Client → Proxy Setup: configures proxy
