IQOption API Library
An updated Python library for interacting with the IQ Option platform using modern asynchronous features like aiohttp and websockets.
Features
- Fully asynchronous.
- Supports real-time data streams (candles, balances, positions).
- Includes utilities for trading operations.
Installation
Install the library (when published) via pip:
pip install iqoption_async
For development:
git clone https://github.com/yourusername/iqoption_async.git
cd iqoption_async
pip install -r requirements.txt
Usage
Initialization
The main client to interact with the API is IQOptionClient. Initialize it with your email and password:
import asyncio
from iqoption_async.client import IQOptionClient
client = IQOptionClient(email="your_email@example.com", password="your_password")
async def main():
success, reason = await client.connect()
if success:
print("Connected successfully!")
else:
print(f"Failed to connect: {reason}")
asyncio.run(main())
Retrieving Profile Data
Fetch the user's profile:
profile = await client.get_profile()
print(f"User ID: {profile.id}")
print(f"Balances: {profile.balances}")
Changing Balance
Switch between practice and real accounts (PRACTICE, REAL):
await client.change_balance("PRACTICE")
balance = await client.get_balance()
print(f"Current practice balance: {balance}")
Fetching Candles
Retrieve candle data for a specific symbol:
candles = await client.get_candles("EURUSD", interval_min=1, limit=10, end_time=time.time())
print(candles)
Buying an Option
Place a trade:
result, order_id, expiration = await client.buy(amount=10, symbol="EURUSD", action="call", expiration=1)
if result:
print(f"Trade successful! Order ID: {order_id}")
else:
print("Trade failed.")
return
mins = math.ceil(((datetime.fromtimestamp(expiration) - datetime.now()).seconds / 60))
# WAIT for result
finded, status, profit = await client.check_order(order_id, mins)
# status -> win, loose, equal, sold
if finded:
print(f"Order with status {status} profit {profit}")
else:
print("Order not found")
# ASYNC for result
async def func(result):
finded, status, profit = result
await client.check_order(order_id, mins, func)
Metadata
Release files for iqoption-async 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| iqoption_async-0.0.1.tar.gz | 11.7 kB | Without provenance | Details for iqoption_async-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| iqoption_async-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for iqoption_async-0.0.1-py3-none-any.whl |
Total release size: 27.8 kB
Release files / iqoption_async-0.0.1.tar.gz
| Download URL | iqoption_async-0.0.1.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c95afabddf2602a07642ebcf6b907c9976f918e4bee6d21937e441bad56d7bbb
|
|
BLAKE2b-256 checksum How to use checksums |
ab0b70113b7c1dbb733c1a82f714109d0435dd4934a6d1f3645548d6efad54c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.10
|
Release files / iqoption_async-0.0.1-py3-none-any.whl
| Download URL | iqoption_async-0.0.1-py3-none-any.whl |
|---|---|
| Size | 16.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a7d5a698aa32aa599fbd8226e7c90ebdb664cce68e12bca124cdb0d72121704f
|
|
BLAKE2b-256 checksum How to use checksums |
963d290452ac54170875dc945f0b2351111d6acf92804483f4802b5c65437a8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.10
|
Security for iqoption-async 0.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.