# chipadevteam/pocketoptionapi architecture

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

- Interactive diagram: https://gitdiagram.com/chipadevteam/pocketoptionapi
- Repository: https://github.com/chipadevteam/pocketoptionapi

## Overview

This is an async Python client for PocketOption trading. A developer supplies an SSID and requests account data, candles, or trades; the client authenticates over WebSocket, routes platform messages, and returns typed results. The package also provides persistent keep-alive connections, connection diagnostics, and error/health monitoring. The README advertises further performance capabilities, but the sampled excerpts do not establish their call paths. The SSID scraper is a separate setup tool. Edges below are limited to excerpted calls or explicit README behavior.

Main entry points: [`pocketoptionapi_async/client.py`](https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/client.py) (Async API client), [`pocketoptionapi_async/websocket_client.py`](https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/websocket_client.py) (WebSocket client), [`pocketoptionapi_async/connection_monitor.py`](https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/connection_monitor.py) (Connection diagnostics), [`tools/get_ssid.py`](https://github.com/chipadevteam/pocketoptionapi/blob/main/tools/get_ssid.py) (SSID scraper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Trading API"]
  node_client["Async API client<br/>[client.py]"]
  node_constants["Assets and regions<br/>[constants.py]"]
  node_models["Trading data models<br/>[models.py]"]
  node_exceptions["API exceptions<br/>[exceptions.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
  node_utils["Trading utilities<br/>[utils.py]"]
end

subgraph group_transport["Connection transport"]
  node_ws["WebSocket client"]
  node_platform(("PocketOption platform"))
  node_keepalive["Persistent connection"]
end

subgraph group_resilience["Reliability and diagnostics"]
  node_connmonitor["Connection diagnostics"]
  node_monitoring["Error and health monitoring<br/>[monitoring.py]"]
end

subgraph group_setup["Credential setup"]
  node_scraper["SSID scraper<br/>[get_ssid.py]"]
  node_driver["Browser driver setup<br/>[driver.py]"]
end

node_developer(("API user"))
node_browser(("User browser login"))

node_developer -->|"requests trading data"| node_client
node_client -->|"connects and sends"| node_ws
node_ws -->|"exchanges messages"| node_platform
node_ws -->|"emits events"| node_client
node_client -->|"validates assets"| node_constants
node_client -->|"builds results"| node_models
node_client -->|"raises errors"| node_exceptions
node_client -.->|"manages persistence"| node_keepalive
node_developer -.->|"starts diagnostics"| node_connmonitor
node_connmonitor -->|"checks account balance"| node_client
node_developer -->|"uses resilience tools"| node_monitoring
node_client -.->|"uses error handling"| node_monitoring
node_client -.->|"uses configuration"| node_config
node_developer -.->|"uses utilities"| node_utils
node_browser -->|"logs in for SSID"| node_scraper
node_scraper -->|"configures browser"| node_driver

click node_client "https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/client.py"
click node_constants "https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/constants.py"
click node_models "https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/models.py"
click node_exceptions "https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/exceptions.py"
click node_ws "https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/websocket_client.py"
click node_keepalive "https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/connection_keep_alive.py"
click node_connmonitor "https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/connection_monitor.py"
click node_monitoring "https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/monitoring.py"
click node_config "https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/config.py"
click node_utils "https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/utils.py"
click node_scraper "https://github.com/chipadevteam/pocketoptionapi/blob/main/tools/get_ssid.py"
click node_driver "https://github.com/chipadevteam/pocketoptionapi/blob/main/tools/driver.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_client,node_constants,node_models,node_exceptions,node_config,node_utils,node_developer,node_browser toneBlue
class node_ws,node_platform,node_keepalive toneAmber
class node_connmonitor,node_monitoring toneMint
class node_scraper,node_driver toneRose
```

## Components

### Trading API

- [Async API client](https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/client.py): `pocketoptionapi_async/client.py`
- [Assets and regions](https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/constants.py): `pocketoptionapi_async/constants.py`
- [Trading data models](https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/models.py): `pocketoptionapi_async/models.py`
- [API exceptions](https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/exceptions.py): `pocketoptionapi_async/exceptions.py`
- [Runtime configuration](https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/config.py): `pocketoptionapi_async/config.py`
- [Trading utilities](https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/utils.py): `pocketoptionapi_async/utils.py`

### Connection transport

- [WebSocket client](https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/websocket_client.py): `pocketoptionapi_async/websocket_client.py`
- **PocketOption platform**
- [Persistent connection](https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/connection_keep_alive.py): `pocketoptionapi_async/connection_keep_alive.py`

### Reliability and diagnostics

- [Connection diagnostics](https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/connection_monitor.py): `pocketoptionapi_async/connection_monitor.py`
- [Error and health monitoring](https://github.com/chipadevteam/pocketoptionapi/blob/main/pocketoptionapi_async/monitoring.py): `pocketoptionapi_async/monitoring.py`

### Credential setup

- [SSID scraper](https://github.com/chipadevteam/pocketoptionapi/blob/main/tools/get_ssid.py): `tools/get_ssid.py`
- [Browser driver setup](https://github.com/chipadevteam/pocketoptionapi/blob/main/tools/driver.py): `tools/driver.py`

### Other components

- **API user**
- **User browser login**

## Connections

- API user → Async API client: requests trading data (evidence: `README.md`)
- Async API client → WebSocket client: connects and sends (evidence: `pocketoptionapi_async/client.py`)
- WebSocket client → PocketOption platform: exchanges messages (evidence: `pocketoptionapi_async/websocket_client.py`)
- WebSocket client → Async API client: emits events (evidence: `pocketoptionapi_async/websocket_client.py`)
- Async API client → Assets and regions: validates assets (evidence: `pocketoptionapi_async/client.py`)
- Async API client → Trading data models: builds results (evidence: `pocketoptionapi_async/client.py`)
- Async API client → API exceptions: raises errors (evidence: `pocketoptionapi_async/client.py`)
- Async API client → Persistent connection: manages persistence (evidence: `pocketoptionapi_async/client.py`)
- API user → Connection diagnostics: starts diagnostics
- Connection diagnostics → Async API client: checks account balance (evidence: `pocketoptionapi_async/connection_monitor.py`)
- API user → Error and health monitoring: uses resilience tools (evidence: `README.md`)
- Async API client → Error and health monitoring: uses error handling (evidence: `pocketoptionapi_async/client.py`)
- Async API client → Runtime configuration: uses configuration
- API user → Trading utilities: uses utilities
- User browser login → SSID scraper: logs in for SSID (evidence: `tools/get_ssid.py`)
- SSID scraper → Browser driver setup: configures browser (evidence: `tools/get_ssid.py`)
