Skip to main content
Glama
Rufus011

CMP-server Pocket Option 2026

by Rufus011
README.md
<div align="center">

<!-- ▓▓ ШАПКА ▓▓ -->
<img src="https://capsule-render.vercel.app/api?type=waving&color=0:00ff88,50:00ffcc,100:0066ff&height=250&section=header&text=CMP-SERVER&fontSize=70&fontColor=ffffff&fontAlignY=34&animation=fadeIn&desc=Pocket%20Option%202026%20%E2%80%A2%20Let%20any%20AI%20read%20the%20market%20and%20trade%20via%20MCP&descAlignY=56&descSize=16&stroke=00ff88&strokeWidth=1" width="100%" alt="CMP-server Pocket Option 2026"/>

<!-- ▓▓ ПЕЧАТАЮЩИЙСЯ ТЕРМИНАЛ ▓▓ -->
<img src="https://readme-typing-svg.demolab.com?font=Fira+Code&weight=600&size=22&pause=1000&color=00FF88&center=true&vCenter=true&width=820&height=55&lines=%24+any+AI+%C2%B7+one+toolset+%C2%B7+one+market;%24+async+%C2%B7+typed+%C2%B7+72+offline+tests;%24+demo+first+%C2%B7+TLS+on+%C2%B7+secrets+redacted;%24+solo+model+%E2%80%94+or+a+whole+trading+desk" alt="typing"/>

<br/>

[![Python](https://img.shields.io/badge/python-3.10_–_3.13-00ff88?style=for-the-badge&logo=python&logoColor=black&labelColor=0d1117)](https://www.python.org/)
[![MCP](https://img.shields.io/badge/MCP-compatible-00ffcc?style=for-the-badge&logo=modelcontextprotocol&logoColor=black&labelColor=0d1117)](https://modelcontextprotocol.io/)
[![License](https://img.shields.io/badge/license-MIT-0066ff?style=for-the-badge&labelColor=0d1117)](LICENSE)
[![Tests](https://img.shields.io/badge/tests-72_passing-00ff88?style=for-the-badge&logo=pytest&logoColor=black&labelColor=0d1117)](tests/)

[![CI](https://github.com/Rufus011/CMP-server_Pocket-option-2026/actions/workflows/ci.yml/badge.svg)](https://github.com/Rufus011/CMP-server_Pocket-option-2026/actions/workflows/ci.yml)
[![Ruff](https://img.shields.io/badge/lint-ruff-0d1117?style=flat-square&logo=ruff&logoColor=00ff88)](https://github.com/astral-sh/ruff)
[![Types: mypy](https://img.shields.io/badge/types-mypy-0d1117?style=flat-square&logo=python&logoColor=00ffcc)](https://mypy-lang.org/)
[![Async](https://img.shields.io/badge/async-socket.io-0d1117?style=flat-square&logo=socketdotio&logoColor=00ff88)](https://python-socketio.readthedocs.io/)

**A modern, async, fully-typed bridge between AI assistants and the PocketOption trading platform.**
Plug it into Claude Code, Claude Desktop, Cursor — or drive it from GPT / Grok — **solo or as a coordinated team of analysts and traders.** Your model can read balances, pull candles, screen assets, and place trades through clean [MCP](https://modelcontextprotocol.io/) tools.

📖 **Full guide (English + Русский):** [`GETTING_STARTED.md`](GETTING_STARTED.md) · ⚙️ [`SETUP.md`](SETUP.md) · 🩺 [`TROUBLESHOOTING.md`](TROUBLESHOOTING.md)

</div>

---

> [!IMPORTANT]
> **This is a terminal / developer tool — not a click-and-run desktop app.** There's
> nothing to double-click: no `.exe`, no installer, no window, no buttons. You set it up
> from a **terminal / command line** (`pip install`, then run a command) and connect it to
> an AI client (Claude Code, Claude Desktop, Cursor) by pasting a small block into that
> client's **config file**. It has no GUI of its own. If you've never used a command line,
> this isn't plug-and-play — start with **[GETTING_STARTED.md](GETTING_STARTED.md)**, which
> walks through every step.

> [!WARNING]
> **Trade responsibly.** Binary options are **negative-expectation by design**, and OTC pairs use synthetic prices the broker controls — no bot changes that math. Real-money trading is **off by default** and only turns on when you explicitly set `PO_ALLOW_REAL=1` / `allow_real=True`. Automated trading may also violate PocketOption's terms of service. Test on a **demo** account first; you use this at your own risk.

## 🎯 What it is — and what it isn't

- **It is** clean, typed, tested **infrastructure**: a way to wire AI models into
  PocketOption over MCP, with real async plumbing, safety-first defaults, per-model
  memory, and multi-agent coordination. A solid base to **build and learn** on.
- **It isn't** a profitable strategy or a "money-making bot." Binary options are
  negative-expectation, and this API is **unofficial (reverse-engineered)**. The tooling
  makes agents **disciplined and safe, not profitable** — treat it as a framework and a
  learning / engineering showcase, and stay on **demo**.

## ✨ Why this exists

Most PocketOption wrappers hand-roll the socket.io protocol, ship broken imports, disable TLS verification, and leak your session token into logs. This one doesn't.

- 🧠 **AI-native** — exposes trading as first-class **MCP tools**, so any MCP host can use it with zero glue code.
- ⚡ **Truly async & event-driven** — built on `python-socketio`; prices, fills and candles resolve on real events, no polling loops.
- 🔒 **Secure by default** — TLS verification **on**, session tokens redacted from every log and protocol dump, real-money trading gated behind an explicit flag.
- 🧩 **Model-agnostic core** — the trading logic lives once in `client.py`; Claude, GPT and Grok are thin facades over it.
- 🧪 **Actually tested** — **72 offline tests** (parsing, routing, safety guards, secret redaction) that need no network and no SSID.
- 🐍 **Typed & pinned** — full type hints, `py.typed`, and a pinned Python version so tools never silently "modernize" your project.

## 🛠️ What your AI can do through it

| Tool | What it does |
|------|--------------|
| 💰 `get_balance` | current balance, demo/live |
| 📋 `list_assets` | tradeable assets with payout % and allowed expirations |
| 🔎 `get_asset_info` | one asset: payout, open/closed, expirations |
| 🕯️ `get_candles` | OHLCV candles at any timeframe (60 / 300 / 900 / 3600 / 14400 s…) |
| 💹 `get_price` | live price for an asset |
| 🎯 `place_trade` | open a trade (call/put, any amount, expiration in seconds) |
| ⏱️ `check_result` | wait for a trade to close → win/loss + profit |
| 📂 `open_positions` | trades currently open |
| 🧾 `trade_history` | recent closed trades |
| 📊 `performance` | win rate and net P&L this session |

The model computes its own indicators from `get_candles` — it never needs to read a chart image.

## 🤝 One model — or a whole trading desk

Connect a single model, or run several **at the same time**. Every model gets the exact same PocketOption toolset, and an optional **shared opinion board** lets them operate as a team — analysts posting reads, a trader acting on the consensus.

| Connect… | How | Name on the board |
|---|---|---|
| **Claude** — Code / Desktop / Cursor | MCP config (`claude_config_example.json`) | `claude` |
| **GPT** — OpenAI | `python run_gpt.py` | `gpt` |
| **Grok** — xAI | `python run_grok.py` | `grok` |
| **Any** OpenAI-compatible — OpenRouter, Ollama, LM Studio, Mistral… | `python run_any.py` | model name |
| **TradingView** market data | add the `tradingview` MCP block — works with any of the above | — |

**Turn them into a desk.** Run two or three models side by side and they coordinate through a shared, TTL-expiring opinion board (`post_opinion` / `read_opinions`): e.g. GPT and Grok each post an analyst read on `EURUSD_otc`, and Claude reads the board and only places the trade when they agree. They can also **talk directly** — `send_message` / `read_messages`, broadcast or addressed to one agent by name — to ask questions, agree a plan, or divide work. Each agent's role is just its **name + instructions** (drop a per-model manual in `agent_manuals/`) — so *you* decide who researches and who pulls the trigger.

```mermaid
%%{init: {'theme':'dark','themeVariables':{'primaryColor':'#0d1117','primaryTextColor':'#c9d1d9','primaryBorderColor':'#00ff88','lineColor':'#00ffcc','fontFamily':'monospace'}}}%%
flowchart TB
    TV["📈 TradingView (optional data)"]
    G["🤖 GPT — analyst"]
    K["🤖 Grok — analyst"]
    B["🗒️ opinions.json — shared board, TTL 15m"]
    C["🤖 Claude — trader"]
    PO["🟢 PocketOption"]

    TV -.-> G
    TV -.-> K
    G -->|post_opinion| B
    K -->|post_opinion| B
    B -->|read_opinions| C
    C -->|place_trade| PO

    style TV fill:#11161d,stroke:#48b0ff,color:#c9d1d9
    style G fill:#11161d,stroke:#00ff88,color:#c9d1d9
    style K fill:#11161d,stroke:#00ff88,color:#c9d1d9
    style B fill:#0d1117,stroke:#00ffcc,color:#00ffcc
    style C fill:#11161d,stroke:#00ff88,color:#c9d1d9
    style PO fill:#0d1117,stroke:#00ff88,color:#00ff88
```

> Roles aren't hardcoded — the board just lets agents post and read each other's views. Whether a model acts as an analyst, a risk-checker, or the one that trades is defined by the prompt/instructions you give it and its `AGENT_NAME`.

## 🏗️ Architecture

```mermaid
%%{init: {'theme':'dark','themeVariables':{'primaryColor':'#0d1117','primaryTextColor':'#c9d1d9','primaryBorderColor':'#00ff88','lineColor':'#00ffcc','fontFamily':'monospace'}}}%%
flowchart LR
    AI["🤖 Claude / GPT / Grok"]
    S["mcp_server.py — MCP facade"]
    C["client.py — model-agnostic core"]
    PO["🟢 PocketOption"]
    M["models.py — typed parsing"]
    MEM["memory.py — strategies + opinions"]
    TV["📈 TradingView MCP (optional)"]

    AI -->|MCP tools| S
    S --> C
    C -->|socket.io / WSS| PO
    C --> M
    C --> MEM
    TV -.->|real-pair data| AI

    style AI fill:#11161d,stroke:#00ff88,color:#c9d1d9
    style S fill:#11161d,stroke:#00ffcc,color:#c9d1d9
    style C fill:#0d1117,stroke:#00ff88,color:#00ff88
    style PO fill:#0d1117,stroke:#00ff88,color:#00ff88
    style M fill:#11161d,stroke:#48b0ff,color:#c9d1d9
    style MEM fill:#11161d,stroke:#48b0ff,color:#c9d1d9
    style TV fill:#11161d,stroke:#48b0ff,color:#c9d1d9
```

The core knows nothing about any LLM. New models plug in as thin facades over the same `client.py` — the trading logic is written once.

<details>
<summary><b>⚡ &nbsp;How a trade actually flows (click to expand)</b></summary>
<br/>

```mermaid
sequenceDiagram
    participant AI as 🤖 AI model
    participant S as mcp_server.py
    participant C as client.py
    participant PO as PocketOption

    AI->>S: place_trade(EURUSD_otc, call, 60s)
    S->>C: validated request (pydantic)
    C->>PO: socket.io order
    PO-->>C: fill event
    C-->>S: trade opened
    S-->>AI: trade_id
    AI->>S: check_result(trade_id)
    PO-->>C: close event
    S-->>AI: win/loss + profit
```

Everything resolves on **real socket events** — no sleep-and-poll loops anywhere in the pipeline.

</details>

## 🚀 Quick start

```bash
# 1. install (registers the `pocketoption-mcp` command)
pip install .

# 2. grab your DEMO SSID from pocketoption.com
#    F12 → Network → websocket → the 42["auth",{...}] frame with "session"/"isDemo"

# 3. point Claude at it — merge the mcpServers block from
#    claude_config_example.json into your Claude / Cursor config, then restart.
```

> [!TIP]
> Then just ask your assistant: *"What PocketOption tools do you have?"* → *"Show my balance and the top 5 OTC pairs by payout."*

<details>
<summary>Run it standalone to sanity-check the connection</summary>

```bash
# bash / zsh
export PO_SSID='42["auth",{...}]'
pocketoption-mcp        # or: python -m cmp_server_pocket_option_2026.mcp_server
```
```powershell
# PowerShell
$env:PO_SSID='42["auth",{...}]'
pocketoption-mcp
```
It should print `Connected to … (demo)` and wait. Ctrl+C to stop.
</details>

Full step-by-step (installing Python, getting the SSID, config file locations) lives in **[`GETTING_STARTED.md`](GETTING_STARTED.md)**.

## 📈 Optional: TradingView for real (non-OTC) pairs

OTC pairs are synthetic, so outside data can't help there — the model reads them from candles alone. For **real** pairs you can run the third-party [`tradingview-mcp`](https://github.com/atilaahmettaner/tradingview-mcp) server *alongside* this one (needs [`uv`](https://astral.sh/uv), **no** TradingView account). The `tradingview` block in `claude_config_example.json` wires it up. Note: PocketOption's `EURUSD` maps to TradingView's `FX:EURUSD` — the two don't share a symbol namespace, so the model bridges them.

## 🧪 Development

```bash
pip install ".[dev]"
pytest                               # 72 offline tests — no network, no SSID
ruff check .                         # lint
mypy cmp_server_pocket_option_2026   # type-check
```

The suite is deliberately **offline**: it swaps the transport for a fake and feeds captured-shape events into the client, validating parsing, routing, safety guards and secret-redaction without ever touching PocketOption. CI runs all three on Python **3.10 / 3.11 / 3.12 / 3.13**.

> [!CAUTION]
> Runtime artifacts (`sessions/`, `strategies/`, `opinions.json`, `dump.jsonl`) are git-ignored. `sessions/` holds your account token — **never commit or share it.**

## 🧰 Tech stack

<div align="center">

<img src="https://skillicons.dev/icons?i=python,githubactions,git&theme=dark"/>

<br/><br/>

<img src="https://img.shields.io/badge/python--socketio-0d1117?style=flat-square&logo=socketdotio&logoColor=00ff88"/>
<img src="https://img.shields.io/badge/pydantic_v2-0d1117?style=flat-square&logo=pydantic&logoColor=00ff88"/>
<img src="https://img.shields.io/badge/MCP-0d1117?style=flat-square&logo=modelcontextprotocol&logoColor=00ffcc"/>
<img src="https://img.shields.io/badge/pytest-0d1117?style=flat-square&logo=pytest&logoColor=00ffcc"/>
<img src="https://img.shields.io/badge/ruff-0d1117?style=flat-square&logo=ruff&logoColor=0066ff"/>
<img src="https://img.shields.io/badge/mypy-0d1117?style=flat-square&logo=python&logoColor=0066ff"/>

</div>

## ⭐ Support the project

<div align="center">

[![Stars](https://img.shields.io/github/stars/Rufus011/CMP-server_Pocket-option-2026?style=for-the-badge&color=00ff88&labelColor=0d1117&logo=github)](https://github.com/Rufus011/CMP-server_Pocket-option-2026/stargazers)
[![Forks](https://img.shields.io/github/forks/Rufus011/CMP-server_Pocket-option-2026?style=for-the-badge&color=00ffcc&labelColor=0d1117&logo=github)](https://github.com/Rufus011/CMP-server_Pocket-option-2026/network/members)
[![Issues](https://img.shields.io/github/issues/Rufus011/CMP-server_Pocket-option-2026?style=for-the-badge&color=0066ff&labelColor=0d1117&logo=github)](https://github.com/Rufus011/CMP-server_Pocket-option-2026/issues)
[![Last commit](https://img.shields.io/github/last-commit/Rufus011/CMP-server_Pocket-option-2026?style=for-the-badge&color=00ff88&labelColor=0d1117&logo=git&logoColor=white)](https://github.com/Rufus011/CMP-server_Pocket-option-2026/commits)

</div>

If this saved you time or you find it interesting, **give it a ⭐** — it's the single biggest thing that helps the project reach other traders and developers. Fork it, build on it, share it (it's MIT).

<div align="center">

[![Share on X](https://img.shields.io/badge/Share_on-X-0d1117?style=for-the-badge&logo=x&logoColor=white)](https://twitter.com/intent/tweet?text=CMP-server%20Pocket%20Option%202026%20%E2%80%94%20let%20any%20AI%20%28Claude%2FGPT%2FGrok%29%20trade%20on%20PocketOption%20via%20MCP%2C%20solo%20or%20as%20a%20team&url=https://github.com/Rufus011/CMP-server_Pocket-option-2026)
[![Telegram](https://img.shields.io/badge/Telegram-@romis__111-00ff88?style=for-the-badge&logo=telegram&logoColor=black&labelColor=0d1117)](https://t.me/romis_111)

</div>

## 🐛 Found a bug? 💡 Have an idea?

Contributions of every size are welcome — the project is actively developed and open to collaborators.

- **🐞 Bug** → [open an issue](https://github.com/Rufus011/CMP-server_Pocket-option-2026/issues/new/choose) with the *Bug report* template. **Redact your SSID** before pasting logs.
- **💡 Feature or improvement** → open an issue with the *Feature request* template.
- **💬 Questions / open discussion** → the [Discussions](https://github.com/Rufus011/CMP-server_Pocket-option-2026/discussions) tab.
- **🔧 Want to code?** → PRs welcome — read [`CONTRIBUTING.md`](CONTRIBUTING.md) first (it's short). Good first areas: new indicators, more model adapters, better desk coordination.

## 💚 Support development

Building and maintaining this is unpaid open-source work. If it's useful to you, a donation keeps it moving — completely optional, and thank you 🙏

<div align="center">

[![Donate on Bybit](https://img.shields.io/badge/Donate-Bybit_·_UID_497849886-F7A600?style=for-the-badge&logo=bybit&logoColor=black&labelColor=0d1117)](https://www.bybit.com/)

<img src="assets/bybit-uid-qr.png" width="150" alt="Bybit UID 497849886"/>

**Bybit UID:** `497849886`

</div>

**How to send:** in the Bybit app, use **Send / transfer by UID** (Bybit Pay), enter UID `497849886`, then pick the coin and amount. Bybit-to-Bybit transfers are instant and fee-free. *(The QR just encodes the UID for quick copying — it doesn't auto-open a payment.)*

<!--
  ▓▓ STAR HISTORY (выключено) ▓▓
  Сервис star-history отвечает слишком медленно — прокси GitHub не дожидается,
  и картинка показывается сломанной. Плюс для молодого репозитория график
  почти пустой. Когда наберётся заметное число звёзд — просто раскомментируй:

## 📈 Star history

<div align="center">

[![Star History Chart](https://api.star-history.com/svg?repos=Rufus011/CMP-server_Pocket-option-2026&type=Date)](https://star-history.com/#Rufus011/CMP-server_Pocket-option-2026&Date)

</div>
-->

## 📜 License

**MIT** © 2026 [Rufus011](https://github.com/Rufus011) — see [`LICENSE`](LICENSE). Build on it freely, trade at your own risk.

<div align="center">

<img src="https://readme-typing-svg.demolab.com?font=Fira+Code&weight=600&size=18&pause=1200&color=00FF88&center=true&vCenter=true&width=620&height=45&lines=built+by+RUFUS_011;typed+%C2%B7+tested+%C2%B7+no+secrets+in+the+repo;stay+on+demo+%E2%80%94+and+have+fun" alt="outro"/>

<a href="https://github.com/Rufus011"><img src="https://img.shields.io/badge/more_projects-github.com%2FRufus011-00ffcc?style=for-the-badge&logo=github&logoColor=white&labelColor=0d1117"/></a>

<!-- ▓▓ ФУТЕР ▓▓ -->
<img src="https://capsule-render.vercel.app/api?type=waving&color=0:0066ff,50:00ffcc,100:00ff88&height=140&section=footer" width="100%" alt="footer"/>

</div>

TDQS

A3.7/5.0

Scored across 24 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: market data (get_candles, get_price), trading (place_trade, check_result), account/trade history (get_balance, open_positions, trade_history), memory (strategies vs skills), and communication (opinions vs messages). No two tools overlap enough to cause misselection.

Naming Consistency3/5

Naming is readable but mixes patterns: get_* and list_* for retrieval, save_*/delete_* for memory, plus noun-only names like performance, trade_history, and open_positions. The inconsistent use of get vs list and the non-verb names prevent a higher score, though the verbs are descriptive.

Tool Count3/5

24 tools falls in the 16-25 'heavy' range, but the scope includes three distinct domains (trading, persistent memory, agent communication), so each cluster earns its place. It is slightly over a typical well-scoped server but not excessive.

Completeness4/5

The trading lifecycle is well covered: market data, balance, trade placement, result checking, open positions, and history. Memory and communication are also complete with CRUD for strategies/skills and send/read for opinions/messages. Minor gaps exist (e.g., no individual opinion deletion, no market news), but core workflows have no dead ends.

Maintenance

ActivityStale
ResponsivenessNo issues