Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

⚡ IQ Option 24/7 REST API System

Enterprise-grade, 24/7 self-healing REST API & WebSocket wrapper for IQ Option (Binary, Turbo, Digital options, Forex, Crypto, and 24/7 OTC pairs).
Designed to stream real-time price feeds, record 8-day M1 candle histories, execute binary & digital orders, and power automated binary options trading bots and signal generators.

Telegram
FastAPI
Python
License


🛒 Commercial License & Purchase Source Code

Looking for the full, production-ready source code with complete rights and 1-on-1 developer support?

What’s Included in the Full Package:

  • 📦 100% Full Unlocked Source Code (app.py, worker.py, database.py, pyiqoption/ engine).
  • 🚀 1-Click Automated Windows Launcher (start_api.bat).
  • Unlimited Personal & Commercial License (Deploy on unlimited VPS/servers).
  • 🛠️ 24/7 Developer Support & Setup Assistance.
  • 🔄 Lifetime Code Updates & Bug Fixes.

📩 Contact on Telegram to Buy: @usmanch069
💳 Accepted Payment Methods: USDT (TRC20), Binance Pay, Crypto.


🚀 Key System Features

  • 📈 Configurable M1 Candle History: Automatically maintains a rolling historical database of closed M1 candles (configurable in .env via RETENTION_DAYS=8) for all active IQ Option assets.
  • 🚫 Anti-Repaint Guarantee: Only finalized, official broker candles are persisted to the database. Running bars are never locked in prematurely.
  • 🔄 Automatic Symbol Resolution: Intelligently normalizes input pairs and aliases (EURUSD, EUR/USD, EURUSD_OTC -> EURUSD-OTC).
  • Live On-Demand Broker Sync: If a requested asset has no candles cached locally, the API queries the broker live on-demand, caches them into iqoption.db, and returns them immediately.
  • 📊 Multi-Timeframe Downsampling: Query candles in 1m (default), 5m, 15m, 30m, or 1h intervals using high-performance OHLC downsampling.
  • 💰 Historical Payout Rate Tracking: Every M1 candle entry stores the exact real-time payout percentage recorded at that specific minute.
  • 🕒 Fully Configurable Timezone Support: All API JSON outputs format timestamps as YYYY-MM-DD HH:MM:SS with fully customizable timezone offsets (e.g. UTC, UTC+6, EST, IST, GMT, etc.) alongside integer unix timestamp.
  • 🛡️ Bulletproof Self-Healing Architecture:
    • Automatically reconnects during network drops or socket disconnections.
    • Automatically clears expired session tokens and re-authenticates via Chrome-impersonated REST login (curl_cffi).
    • Automatically detects offline downtime gaps and backfills missing candles in the background.
  • 📊 Real-Time ASCII Terminal UI: Beautiful live console dashboard featuring colored status indicators, account balances (Demo & Real), asset sync counters, and visual progress bars.
  • 🌐 Interactive Glassmorphic Web Portal: Includes a modern dark-mode web portal at http://127.0.0.1:8000/ for visual testing and interactive API querying.

🏗️ Architecture & Project Structure

iqoption/
├── pyiqoption/         # Production Asynchronous IQ Option WebSocket & REST API Engine
│   ├── _api/           # Mixins: account, trading, realtime, history, assets
│   ├── network/        # Chrome TLS impersonation, login, SSL contexts
│   ├── utils/          # Indicator math, async event registry, cache
│   ├── ws/             # Resilient WebSocket client, channels, objects
│   ├── stable_api.py   # Unified IQOption client orchestrator
│   └── config.py       # Dual-tier session management
├── src/
│   ├── app.py          # FastAPI REST Server, Interactive Web Portal & Webhooks
│   ├── worker.py       # Background Ingestion Daemon & Live Streamer
│   ├── database.py     # SQLite Persistence & Retention Daemon
│   └── delete_asset.py # Database Candle Purge CLI Utility
├── iqoption.db         # Root SQLite Database (Candles & Payouts)
├── start_api.bat       # 1-Click Windows Production Launcher
├── requirements.txt    # Python Dependencies
├── .env                # Environment & Credentials Configuration
├── BUYER_GUIDE.txt     # Setup Guide for Customers
└── README.md           # System Documentation

⚙️ Quick Start Guide

1. Prerequisites

  • Python 3.10+ (Ensure Add Python to PATH is enabled).
  • Windows or Linux OS (VPS / Desktop / Laptop).

2. Configuration

Configure your IQ Option login details in .env:

IQ_EMAIL=your_email@gmail.com
IQ_PASSWORD=your_password
timezone=UTC
RETENTION_DAYS=8

3. Launching the API

Double-click start_api.bat (or run python -m uvicorn src.app:app --host 127.0.0.1 --port 8000).


🌐 API Endpoint Documentation & Examples

1. Web Portal Dashboard

  • Full Request URL: http://127.0.0.1:8000/
  • Description: Open in any web browser for interactive API querying, live database metrics, and sandbox testing.

2. Get Live Payouts & Market Status

Returns all active/inactive IQ Option assets, categories (Binary, Turbo, Digital), and live payout rates.

  • Endpoint: /api/v1/markets
  • Example Request: GET http://127.0.0.1:8000/api/v1/markets
  • Response Format:
{
  "timezone": "UTC",
  "total_assets": 45,
  "data": [
    {
      "symbol": "EURUSD",
      "display_name": "EUR/USD",
      "category": "turbo",
      "modes": [{"category": "turbo"}],
      "payout_percent": 87.0,
      "is_active": true
    },
    {
      "symbol": "EURUSD-OTC",
      "display_name": "EUR/USD OTC",
      "category": "turbo",
      "modes": [{"provider": "OTC", "category": "turbo"}],
      "payout_percent": 92.0,
      "is_active": true
    }
  ]
}

3. Get M1 & Multi-Timeframe Candles History

Retrieves historical candle records for a symbol in chronological order (oldest first). Automatically fetches from broker on-demand if cache is cold.

  • Endpoint: /api/v1/candles
  • Example Request: GET http://127.0.0.1:8000/api/v1/candles?symbol=EURUSD&limit=1000&timeframe=1m&timezone=UTC
  • Query Parameters:
    • symbol (string, required): Asset symbol (e.g. EURUSD, EURUSD-OTC, BTCUSD).
    • limit (integer, optional): Maximum candles to retrieve (default: 1000, max: 11520).
    • timeframe (string, optional): Timeframe period (1m, 5m, 15m, 30m, 1h). Default: 1m.
    • timezone (string, optional): Target timezone offset (e.g. UTC, UTC+6, EST, IST, +5.5). Defaults to .env setting.
  • Response Format:
{
  "symbol": "EURUSD",
  "original_query": "EURUSD",
  "timeframe": "1m",
  "timezone": "UTC",
  "candle_count": 2,
  "candles": [
    {
      "timestamp": 1789307760,
      "time": "2026-09-13 13:56:00",
      "open": 1.08542,
      "high": 1.08548,
      "low": 1.08535,
      "close": 1.08538,
      "volume": 12.0,
      "payout": 87.0
    },
    {
      "timestamp": 1789307820,
      "time": "2026-09-13 13:57:00",
      "open": 1.08538,
      "high": 1.08552,
      "low": 1.08535,
      "close": 1.08549,
      "volume": 18.0,
      "payout": 87.0
    }
  ]
}

4. Place Trade (URL / GET Request)

Places an order directly from a URL or GET request. Ideal for browser bookmarks, webhooks, and 1-click execution.

  • Endpoint: /api/v1/trade
  • Example Request: GET http://127.0.0.1:8000/api/v1/trade?symbol=EURUSD&action=call&amount=1&duration=60&account_type=DEMO
  • Parameters:
    • symbol (string, required): Asset name (e.g. EURUSD, EURUSD-OTC).
    • action (string, required): call / up or put / down.
    • amount (float, optional): Stake amount in $ (default: 1.0).
    • duration (integer, optional): Expiry duration in seconds (default: 60).
    • account_type (string, optional): DEMO or REAL (default: DEMO).

5. Place Trade (JSON / POST Request)

Places a trade using a JSON payload. Ideal for Python trading bots, cURL, and external automated systems.

  • Endpoint: /api/v1/trade
  • Method: POST
  • Payload Example:
{
  "symbol": "EURUSD",
  "action": "call",
  "amount": 1.0,
  "duration": 60,
  "account_type": "DEMO"
}
  • Response Format:
{
  "status": "success",
  "symbol": "EURUSD",
  "action": "CALL",
  "amount": 1.0,
  "duration": 60,
  "account_type": "DEMO",
  "order_id": "98127391",
  "result": {
    "order_id": 98127391
  }
}

6. Get Active Deals & Settlement Outcome

  • List Active / Settled Deals: GET /api/v1/deals
  • Check Trade Settlement: GET /api/v1/trade/result?trade_id=98127391

7. TradingView Webhook Auto-Trader

Universal webhook receiver for TradingView Pine Script alerts.

  • Endpoint: /webhook
  • Method: POST
  • TradingView Alert Message:
{
  "symbol": "{{ticker}}",
  "action": "call",
  "amount": 1.0,
  "duration": 60,
  "account_type": "DEMO"
}

🛠️ Maintenance & Database Purging Tool

Includes an interactive CLI tool (src/delete_asset.py) allowing you to selectively inspect or delete candle history in iqoption.db.

python src/delete_asset.py

Interactive Console Features:

  • Lists all asset pairs stored in iqoption.db with exact candle counts.
  • Enter a pair number or symbol name to purge candles for a single asset.
  • Type ALL to wipe the database and start fresh.

🔍 GitHub SEO & Search Keywords

iq option api · iq option otc api · iq option python wrapper · iq option websocket bot · binary options api · iq option signal bot · fastapi iq option · iq option payouts api · iq option history candles · iq option auto trading · tradingview iq option webhook · binary options python bot · iq option turbo trading · digital options api · realtime quotes websocket · pyiqoption


📬 Contact & Support

For sales inquiries, custom feature additions, or integration help, message directly on Telegram:
👉 @usmanch069


⚠️ Disclaimer

This software is provided for educational and personal use only. Trading financial instruments carries significant risk of loss. The authors are not responsible for any financial losses incurred through the use of this software. Always test on a demo account before using with live funds.

About

⚡ 24/7 Production REST API & WebSocket System for IQ Option. Real-time M1 candle streaming, historical SQLite persistence, live payouts, binary & digital trading, and TradingView webhook integration.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors