High-performance, production-ready Python client with Playwright login (SSID) & full trade lifecycle.
- ⚡ Async: non-blocking WebSocket client optimized for realtime data
- 🔐 Playwright Login: automated SSID extraction & reuse (demo/live)
- 📈 Market Data: assets, payouts, quotes, and real-time candles
- 🧾 Orders: open, track, and resolve full trade lifecycle (WIN/LOSS/DRAW)
- 🩺 Monitoring: structured logging & health checks
- 🧪 Examples: quick-start scripts for connection, candles, and orders
- Installation
- Quick Start
- Why Playwright?
- Architecture
- Examples
- Sessions & SSID
- Troubleshooting
- Contact
- Contributing
- License
git clone https://github.com/A11ksa/API-Quotex
cd API-Quotex
python -m venv venv
# Linux/macOS:
source venv/bin/activate
# Windows:
venv\Scripts\activate
pip install -U pip
pip install .
python -m playwright install chromiumimport asyncio
from api_quotex import AsyncQuotexClient, OrderDirection, get_ssid
async def main():
# 1) Get / refresh SSID via Playwright helper (opens browser on first run)
ssid_info = get_ssid(email="you@example.com", password="YourPassword")
demo_ssid = ssid_info.get("demo") # or "live"
# 2) Connect
client = AsyncQuotexClient(ssid=demo_ssid, is_demo=True)
if not await client.connect():
print("Failed to connect")
return
# 3) Balance
bal = await client.get_balance()
print(f"Balance: {bal.balance} {bal.currency}")
# 4) Place order (60s CALL example)
order = await client.place_order(
asset="AUDCAD_otc",
amount=5.0,
direction=OrderDirection.CALL,
duration=60
)
# 5) Await result
profit, status = await client.check_win(order.order_id)
print("Result:", status, "Profit:", profit)
# 6) Disconnect
await client.disconnect()
if __name__ == "__main__":
asyncio.run(main())- ✅ Maintains parity with browser behavior (anti-bot friendly)
- ✅ Simplifies cookie/session extraction (SSID)
- ✅ Robust to UX changes vs brittle HTTP scraping
- ✅ Easy to refresh sessions and switch demo/live
+---------------------+
| Playwright Helper | (Login UI)
| - opens browser |--> SSID saved to sessions/session.json
+----------+----------+
|
v
+---------------------+ WebSocket (AsyncIO)
| AsyncQuotexClient |<-------------------------------> Quotex WS
| - connect | - quotes, candles, orders
| - assets/payouts |
| - place/check |
+---------------------+
# Pseudocode outline; see your client for exact APIs
await client.subscribe_candles(asset="EURUSD_otc", timeframe=60)
async for candle in client.iter_candles("EURUSD_otc", 60):
print(candle.time, candle.open, candle.close)order = await client.place_order(
asset="EURUSD_otc",
amount=10.0,
direction=OrderDirection.PUT,
duration=60
)
profit, status = await client.check_win(order.order_id)
print(status, profit)- First run opens Chromium and stores SSID in
sessions/session.json - Subsequent runs reuse it until expiry (then it auto-refreshes via login)
Manual override
{
"live": "A8i6rBIfrfrfUYD9BkfGKv00000akJkSeouX73q",
"demo": "A8i6rBIfrfrfUYD9BkfGKv00000akJkSeouX73q"
}- No browser installed?
python -m playwright install chromium - Auth error? Delete
sessions/session.jsonand retry login - No data / timeouts? Check region, network, and broker status
- SSL errors? Ensure your Python/OpenSSL environment is clean
Tip: Logs are written as
log-YYYY-MM-DD.txt. Attach them when opening GitHub issues.
- Author: Ahmed (ar123ksa@gmail.com)
- Telegram: @A11ksa
PRs are welcome. Please:
- Open an issue describing the change
- Keep style consistent (PEP 8 + type hints)
- Add tests where meaningful
MIT — see LICENSE.
Thanks to the community for continued feedback and to the maintainers for the Playwright + AsyncIO integration.