PocketOptionAPI Async

API Reference

Class: AsyncPocketOptionClient

AsyncPocketOptionClient(ssid, is_demo=True, enable_logging=True, ...)

Creates a new asynchronous client for Pocket Option. This is the main entry point for all API operations.

from pocketoptionapi_async import AsyncPocketOptionClient
client = AsyncPocketOptionClient("SSID", is_demo=True, enable_logging=True)

This object must be used with await for all network operations.

Method: await client.connect()

Establishes a connection to Pocket Option using your SSID. Must be awaited before any trading or data calls.

await client.connect()

Returns: True if connected successfully, otherwise raises an error.

Method: await client.disconnect()

Disconnects from Pocket Option and cleans up resources.

await client.disconnect()

Method: await client.get_balance()

Fetches your current account balance and currency.

balance = await client.get_balance()
print(balance.balance, balance.currency)

Returns: Balance object with balance (float), currency (str), and is_demo (bool).

Method: await client.get_candles(asset, timeframe, count=100, end_time=None)

Retrieves historical candle (OHLC) data for a given asset and timeframe.

candles = await client.get_candles("EURUSD_otc", 60)
for candle in candles:
    print(candle.open, candle.close)

Returns: List of Candle objects.

Method: await client.get_candles_dataframe(asset, timeframe, ...)

Retrieves candle data as a pandas DataFrame for easy analysis.

df = await client.get_candles_dataframe("EURUSD_otc", 60)
print(df.head())

Returns: pandas.DataFrame with OHLCV columns indexed by timestamp.

Method: await client.place_order(asset, amount, direction, duration)

Places a binary options order (CALL/PUT) for a given asset, amount, direction, and duration.

from pocketoptionapi_async import OrderDirection
order = await client.place_order(
    asset="EURUSD_otc",
    amount=1.0,
    direction=OrderDirection.CALL,
    duration=60
)
print(order.order_id, order.status)

Returns: OrderResult object with order details and status.

Method: await client.get_active_orders()

Returns a list of your currently active (open) orders.

orders = await client.get_active_orders()
for order in orders:
    print(order.order_id, order.status)

Returns: List of OrderResult objects.

Method: await client.check_order_result(order_id)

Checks the result of a specific order by its ID (win/loss/pending).

result = await client.check_order_result(order_id)
if result:
    print(result.status, result.profit)

Returns: OrderResult object or None if not found.

Method: client.get_connection_stats()

Returns connection statistics and status as a dictionary.

stats = client.get_connection_stats()
print(stats)

Enum: OrderDirection

Specifies the direction of an order.

from pocketoptionapi_async import OrderDirection
OrderDirection.CALL  # "call"
OrderDirection.PUT   # "put"