PocketOption API- By ChipaDevTeam - Modified by Six <3
Support us
Join PocketOption with Six's affiliate link: Six PocketOption Affiliate link
Join PocketOption with Chipas affiliate link: Chipas PocketOption Affiliate link
A comprehensive, modern async Python API for PocketOption trading platform with advanced features including persistent connections, monitoring, and extensive testing frameworks.
Key Features
Enhanced Connection Management
- Complete SSID Format Support: Works with full authentication strings from browser (format:
42["auth",{"session":"...","isDemo":1,"uid":...,"platform":1}]) - Persistent Connections: Automatic keep-alive with 20-second ping intervals (like the original API)
- Auto-Reconnection: Intelligent reconnection with multiple region fallback
- Connection Pooling: Optimized connection management for better performance
Advanced Monitoring & Diagnostics
- Real-time Monitoring: Connection health, performance metrics, and error tracking
- Diagnostics Reports: Comprehensive health assessments with recommendations
- Performance Analytics: Response times, throughput analysis, and bottleneck detection
- Alert System: Automatic alerts for connection issues and performance problems
Comprehensive Testing Framework
- Load Testing: Concurrent client simulation and stress testing
- Integration Testing: End-to-end validation of all components
- Performance Benchmarks: Automated performance analysis and optimization
- Advanced Test Suites: Edge cases, error scenarios, and long-running stability tests
Performance Optimizations
- Message Batching: Efficient message queuing and processing
- Concurrent Operations: Parallel API calls for better throughput
- Caching System: Intelligent caching with TTL for frequently accessed data
- Rate Limiting: Built-in protection against API rate limits
Robust Error Handling
- Graceful Degradation: Continues operation despite individual failures
- Automatic Recovery: Self-healing connections and operations
- Comprehensive Logging: Detailed error tracking and debugging information
- Exception Management: Type-specific error handling and recovery strategies
Installation
# Clone the repository
git clone <repository-url>
cd PocketOptionAPI
# Install dependencies
pip install -r requirements.txt
# For development
pip install -r requirements-dev.txt
Quick Start
Getting Your SSID
To use the API with real data, you need to extract your session ID from the browser:
- Open PocketOption in your browser
- Open Developer Tools (F12)
- Go to Network tab
- Filter by WebSocket (WS)
- Look for authentication message starting with
42["auth" - Copy the complete message including the
42["auth",{...}]format
Example SSID format:
42["auth",{"session":"abcd1234efgh5678","isDemo":1,"uid":12345,"platform":1}]
If you are unable to find it, try running the automatic SSID scraper under the tools folder.
Common errors
Authentication timeout or connection immediately closes
If you see errors like:
WARNING | pocketoptionapi_async.websocket_client:receive_messages:395 - WebSocket connection closed
WARNING | pocketoptionapi_async.client:_start_regular_connection:245 - Failed to connect to region DEMO: Authentication timeout
Solution: Your SSID is likely in the wrong format or is expired. Make sure you are using the complete SSID format, not just the session ID:
✅ Correct format:
SSID = '42["auth",{"session":"n1p5ah5u8t9438rbunpgrq0hlq","isDemo":1,"uid":84402008,"platform":1}]'
❌ Wrong format (just the session):
SSID = 'dxxxxxxxxxxxxxxxxxxxxxxxxxxxx' # This won't work!
To get the correct SSID:
- Open PocketOption in your browser
- Open Developer Tools (F12)
- Go to Network tab
- Filter by "WS" (WebSocket)
- Look for a message that starts with
42["auth", - Copy the entire message including the
42["auth",{...}]part
Websockets version error
Traceback:
2025-07-13 15:25:16.531 | INFO | pocketoptionapi_async.client:__init__:130 - Initialized PocketOption client (demo=True, uid=105754921, persistent=False) with enhanced monitoring
2025-07-13 15:25:16.532 | INFO | pocketoptionapi_async.client:connect:162 - Connecting to PocketOption...
2025-07-13 15:25:16.532 | INFO | pocketoptionapi_async.client:_start_regular_connection:187 - Starting regular connection...
2025-07-13 15:25:16.532 | INFO | pocketoptionapi_async.client:_start_regular_connection:198 - Demo mode: Using demo regions: ['DEMO', 'DEMO_2']
2025-07-13 15:25:16.532 | INFO | pocketoptionapi_async.client:_start_regular_connection:219 - Trying region: DEMO with URL: wss://demo-api-eu.po.market/socket.io/?EIO=4&transport=websocket
2025-07-13 15:25:16.532 | INFO | pocketoptionapi_async.websocket_client:connect:162 - Attempting to connect to wss://demo-api-eu.po.market/socket.io/?EIO=4&transport=websocket
2025-07-13 15:25:16.556 | WARNING | pocketoptionapi_async.websocket_client:connect:206 - Failed to connect to wss://demo-api-eu.po.market/socket.io/?EIO=4&transport=websocket: BaseEventLoop.create_connection() got an unexpected keyword argument 'extra_headers'
2025-07-13 15:25:16.556 | WARNING | pocketoptionapi_async.client:_start_regular_connection:242 - Failed to connect to region DEMO: Failed to connect to any WebSocket endpoint
2025-07-13 15:25:16.556 | INFO | pocketoptionapi_async.client:_start_regular_connection:219 - Trying region: DEMO_2 with URL: wss://try-demo-eu.po.market/socket.io/?EIO=4&transport=websocket
2025-07-13 15:25:16.556 | INFO | pocketoptionapi_async.websocket_client:connect:162 - Attempting to connect to wss://try-demo-eu.po.market/socket.io/?EIO=4&transport=websocket
2025-07-13 15:25:16.558 | WARNING | pocketoptionapi_async.websocket_client:connect:206 - Failed to connect to wss://try-demo-eu.po.market/socket.io/?EIO=4&transport=websocket: BaseEventLoop.create_connection() got an unexpected keyword argument 'extra_headers'
2025-07-13 15:25:16.558 | WARNING | pocketoptionapi_async.client:_start_regular_connection:242 - Failed to connect to region DEMO_2: Failed to connect to any WebSocket endpoint
Traceback (most recent call last):
File "/Users/vigowalker/Downloads/resurgenthavoc_bot/test1.py", line 20, in <module>
asyncio.run(main())
File "/Users/vigowalker/Downloads/resurgenthavoc_bot/.conda/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/Users/vigowalker/Downloads/resurgenthavoc_bot/.conda/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vigowalker/Downloads/resurgenthavoc_bot/.conda/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/vigowalker/Downloads/resurgenthavoc_bot/test1.py", line 9, in main
account_info = await client.get_balance()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/vigowalker/Downloads/resurgenthavoc_bot/.conda/lib/python3.11/site-packages/pocketoptionapi_async/client.py", line 376, in get_balance
raise ConnectionError("Not connected to PocketOption")
pocketoptionapi_async.exceptions.ConnectionError: Not connected to PocketOption
to fix this error, run this commands:
pip uninstall websockets
pip install websockets==11.0
Metadata
Release files for pocketoptionapi-async 2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pocketoptionapi_async-2.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Release files / pocketoptionapi_async-2.0.1-py3-none-any.whl
| Download URL | pocketoptionapi_async-2.0.1-py3-none-any.whl |
|---|---|
| Size | 50.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc97eca565ea8211662e62a56a076453b2069753ca1eb27ba43ab7274ab9d111
|
|
BLAKE2b-256 checksum How to use checksums |
b558aa5d111c5b83f9e11b1a96f7093b3fa29597c7ddb82c15d47c3f37961e1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for pocketoptionapi-async 2.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.