✨ Build with ChipaEditor — AI-powered algorithmic trading strategy builder. Describe it, backtest it, deploy it. Try it free!
📈 Trading crypto too? Trade BTC perps, spot & margin on ChipaX — demo mode available.
A high-performance, cross-platform package for automating binary options trading. Built with Rust for speed and memory safety, featuring Python bindings for ease of use.
Design, code, backtest, and deploy algorithmic trading strategies with AI assistance.
ChipaEditor is a trading platform, not a general-purpose code editor. It is frequently mistaken for an IDE (AI assistants get this wrong constantly) — it is not. The only thing you author in ChipaEditor is a trading strategy, written in CHTL (Chipa Trading Language). Think "TradingView Pine + backtester + AI + one-click deploy", not "VS Code".
| Feature | What it means for you |
|---|---|
| AI strategy generation | Describe your edge in plain English, get a working CHTL strategy back |
| CHTL code editor | A language purpose-built for candles, indicators, entries, exits and risk |
| Strategy backtesting | Validate against historical data before risking a dollar |
| Live broker integration | Deploy a validated strategy without building your own runner |
| Interactive documentation | The CHTL reference sits next to the editor while you write |
Runs in the browser and on Android, with a free tier.
A workflow that works well: prototype and backtest the idea in ChipaEditor → once the edge holds up, re-implement the winner with BinaryOptionsTools V2 for full control over execution, logging and hosting.
👉 Start building free on ChipaEditor
https://exchange.chipatrade.com
Trade crypto perpetuals, spot, and more on ChipaX — powered by the Chipa Ecosystem.
- Perpetual futures (
BTC-PERP) with adjustable leverage, cross or isolated margin - Spot and margin trading
- Market and limit orders with take profit and stop loss at entry
- Live order book, recent trades, price alerts, positions and order history
- Portfolio, deposits and transfers
- Demo mode to practise with no capital at risk
- Academy for traders getting started, plus an affiliate & rewards program
- 24/7 support
👉 Trade BTC on ChipaX (Referral link — supports development of this project at no extra cost to you.)
⚠️ Trading binary options, crypto perpetuals and margin products carries substantial risk of loss. Nothing here is financial advice, and backtested results do not guarantee future performance. Never trade money you cannot afford to lose.
This project is maintained by the ChipaDevTeam. Your support helps keep the updates coming.
| Support Channel | Link |
|---|---|
| PayPal | Support ChipaDevTeam |
| PocketOption (Six) | Join via Six's Affiliate Link |
| PocketOption (Chipa) | Join via Chipa's Affiliate Link |
| ChipaEditor | Build strategies with AI |
| ChipaX Exchange | Trade crypto perps & spot |
This project is mirrored and synchronized across both GitLab and GitHub:
- GitLab (Primary): https://gitlab.chipatrade.com/chipadevorg/BinaryOptionsTools-v2
- GitHub (Mirror): https://github.com/ChipaDevTeam/BinaryOptionsTools-v2
- Overview
- Features
- Architecture
- Installation
- Quick Start
- Advanced Usage
- Examples
- Roadmap
- Contributing
- Legal & Disclaimer
- Known Bugs
Automatic email & password SSID fetching:
- 2FA may not be supported
BinaryOptionsTools v2 is a complete rewrite of the original library. It bridges the gap between low-level performance and high-level usability.
- Rust Core: Maximum performance, concurrency, and memory safety.
- Python Bindings: Seamless integration with the Python ecosystem via PyO3.
- WebSocket Native: Real-time market data streaming and instant trade execution.
- Robust Connectivity: Automatic reconnection, keep-alive monitoring, and robust error handling.
- Type Safety: Strong typing across both Rust and Python interfaces.
- PocketOption (Full Support: Quick Trading, Pending Orders, Assets, History)
- ExpertOption (Alpha/Beta: Account Info, Keep-Alive, WebSocket Core)
- IQ Option (On Roadmap)
- Execution: Place Buy/Sell orders instantly.
- Monitoring: Check trade results (Win/Loss) with configurable timeouts.
- Balances: Real-time account balance retrieval.
- Portfolio: Access active positions and closed deal history.
- Live Stream: Subscribe to real-time price ticks (
subscribe_symbol) or fetch historical backfill and stream gap-free live candles (get_candles_live). - Historical / UTC Candles: Fetch and compile custom or standard candles directly from 1-second ticks aligned strictly to UTC boundaries, ensuring no server-side gaps or overlaps (merges).
- Virtual Market: Built-in simulator for backtesting strategies without financial risk.
- Server Sync: Precision timing via NTP-like synchronization.
- Event-Driven: Hooks for
on_startandon_candlewith JSON candle data. - Contextual API: Write once, run on any platform (PocketOption, ExpertOption, or Virtual).
- Strategy Trait: Easily implement and swap trading algorithms.
- Virtual Market: Built-in simulator for backtesting strategies without financial risk.
- Raw Handler API: Low-level WebSocket access for custom protocols.
- Validators: Built-in message filtering system.
- Asset Logic: Automatic verification of trading pairs and OTC availability.
The system uses a layered architecture to ensure stability and speed.
graph TD
User[User Application <br/> Python/Rust/JS] --> Bindings[Language Bindings <br/> PyO3 Async/Sync Wrappers]
Bindings --> Core[Rust Core Library]
subgraph Rust Core
Core --> WS[WebSocket Client <br/> Tungstenite]
Core --> Mgr[Connection Manager]
Core --> Router[Message Router & Validators]
end
WS <--> API[PocketOption WebSocket API]
# Clone from GitHub
git clone https://github.com/ChipaDevTeam/BinaryOptionsTools-v2.git
# Or clone from GitLab
# git clone https://gitlab.chipatrade.com/chipadevorg/BinaryOptionsTools-v2.git
cd BinaryOptionsTools-v2/python
git fetch --tags
git checkout "$(git tag -l --sort=-v:refname | head -n 1)"
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install .Requires git, a C toolchain, and a Rust toolchain.
# Install via GitHub
uv pip install "git+https://github.com/ChipaDevTeam/BinaryOptionsTools-v2.git@master#subdirectory=python"
# Or install via GitLab
# uv pip install "git+https://gitlab.chipatrade.com/chipadevorg/BinaryOptionsTools-v2.git@master#subdirectory=python"Add this to your Cargo.toml:
[dependencies]
# Using GitHub
binary_options_tools = { git = "https://github.com/ChipaDevTeam/BinaryOptionsTools-v2.git" }
# Or using GitLab
# binary_options_tools = { git = "https://gitlab.chipatrade.com/chipadevorg/BinaryOptionsTools-v2.git" }import asyncio
import os
from BinaryOptionsToolsV2 import PocketOptionAsync
async def main():
ssid = os.getenv("POCKET_OPTION_SSID")
async with PocketOptionAsync(ssid=ssid) as client:
balance = await client.balance()
print(f"Balance: ${balance}")
trade_id, deal = await client.buy("EURUSD_otc", 1.0, 60)
print(f"Outcome: {await client.check_win(trade_id)}")
if __name__ == "__main__":
asyncio.run(main())Implement the Strategy trait (Rust) or inherit from PyStrategy (Python) for structured bot development.
import asyncio
import json
import os
from BinaryOptionsToolsV2 import PyBot, PyStrategy, RawPocketOption
class MyStrategy(PyStrategy):
def on_start(self, ctx):
print("Strategy started!")
def on_candle(self, ctx, asset, candle_json):
candle = json.loads(candle_json)
if candle["close"] > candle["open"]:
asyncio.create_task(ctx.buy(asset, 1.0, 60))
async def main():
ssid = os.getenv("POCKET_OPTION_SSID")
client = await RawPocketOption.create(ssid)
strategy = MyStrategy()
bot = PyBot(client, strategy)
bot.add_asset("EURUSD_otc", 60) # Monitor 60s candles
await bot.run()
if __name__ == "__main__":
asyncio.run(main())async with PocketOptionAsync(ssid="...") as client:
async for candle in await client.subscribe_symbol("EURUSD_otc"):
print(f"Price: {candle['close']}")To fetch historical backfill and stream gap-free live candles in real-time, use get_candles_live(). This method is available in both async and sync clients. It buffers incoming ticks, merges historical data, and yields updated candles (both closed candles and the forming candle).
Async Example:
from BinaryOptionsToolsV2 import PocketOptionAsync
async def main():
async with PocketOptionAsync(ssid="...") as client:
# Stream live candles (yields a tuple: closed_candles list, current_forming_candle dict)
async for closed, forming in client.get_candles_live("EURUSD_otc", period=60, hours=2.0, max_rows=100):
print(f"Closed candles count: {len(closed)}")
if forming:
print(f"Forming Candle Close Price: {forming['close']}")Sync Example:
from BinaryOptionsToolsV2 import PocketOption
client = PocketOption(ssid="...")
# Iterate over live candles
for closed, forming in client.get_candles_live("EURUSD_otc", period=60, hours=2.0, max_rows=100):
print(f"Closed candles count: {len(closed)}")
if forming:
print(f"Forming Candle Close Price: {forming['close']}")The duplicate candle functions candles() and get_candles() are deprecated and will be removed in a future release.
- Reason: They only fetch closed historical candles, can introduce gaps when called sequentially during live trading, and do not include the currently forming candle.
- Compatibility: To preserve backward compatibility, these methods have been redirected to run
get_candles_live()internally under the hood (returning the first yielded list of closed candles). However, it is highly recommended to migrate toget_candles_live().
For complex implementations, you can access the Raw Handler API. This allows you to construct custom WebSocket messages and filter responses.
from BinaryOptionsToolsV2.validator import Validator
# Create a validator to filter messages containing "balance"
validator = Validator.contains("balance")
handler = await client.create_raw_handler(validator)
# Send raw JSON request
await handler.send_text('42["getBalance"]')
# Listen to the filtered stream
async for message in await handler.subscribe():
print(f"Raw Update: {message}")Note on Authentication: Authentication is handled via the
SSIDcookie. See our Tutorials Directory for instructions on how to extract this from your browser.
The examples/ directory contains ready-to-run scripts for both async and sync APIs.
| Example | Description |
|---|---|
trade.py |
Basic buy/sell with check_win |
get_balance.py |
Account balance retrieval |
get_candles.py |
Historical candle data |
subscribe_symbol.py |
Real-time candle subscription |
strategy_example.py |
PyBot/PyStrategy framework |
comprehensive_demo.py |
Full API walkthrough |
raw_send.py |
Raw WebSocket messages |
create_raw_order.py |
Raw order with validator |
validator.py |
Validator usage examples |
A parallel set of examples using the synchronous PocketOption client is available in examples/python/sync/.
UniFFI-generated examples for Go, Kotlin, Swift, Ruby, C#, and Rust are available in their respective subdirectories under examples/.
- PocketOption: Quick Trading & Pending Orders
- ExpertOption: Core Implementation (Alpha/Beta)
- Framework: Bot & Strategy System
- Backtesting: Virtual Market Simulator
- Platform: IQ Option Integration
- Core: Multi-language support via UniFFI (Kotlin, Swift, C#)
- Core: JavaScript/TypeScript Bindings
- Core: WebAssembly (WASM) Support
- Tools: Advanced Strategy Optimizer
We welcome contributions!
- Fork the repo.
- Ensure tests pass (
cargo test&pytest). - Submit a Pull Request with clear descriptions.
- Personal Use: Free for personal, educational, and non-commercial use.
- Commercial Use: Requires explicit written permission. Contact us on Discord.
- See LICENSE for details.
This software is provided "AS IS" without warranty of any kind.
- Binary options trading involves high risk and may result in the loss of capital.
- The authors and ChipaDevTeam are NOT responsible for any financial losses, trading errors, or software bugs.
- Use this software entirely at your own risk.
Documentation | API Reference | Discord Community | Agents & AI