🧠 PocketOptionAsync API Reference
📥 Import
from BinaryOptionsToolsV2.pocketoption import PocketOptionAsync
import asyncio
🧩 Class: PocketOptionAsync
This class allows asynchronous trading on PocketOption using a given SSID. It automatically detects whether the SSID is for a real or demo account.
Constructor
PocketOptionAsync(ssid: str)
Parameters:ssid
– session identifier (demo or real account)
🔁 Method: buy()
Opens a buy trade.
await api.buy(asset="EURUSD_otc", amount=1.0, time=15, check_win=False)
Returns:
Tuple: (id, status)
🔁 Method: sell()
Opens a sell trade.
await api.sell(asset="EURUSD_otc", amount=1.0, time=300, check_win=False)
Returns:
Tuple: (id, status)
✅ Method: check_win()
Checks the result of a trade using its ID.
await api.check_win(trade_id)
Returns:
A dictionary containing trade result information.
💡 Example Usage
async def main(ssid: str):
api = PocketOptionAsync(ssid)
(buy_id, _) = await api.buy(asset="EURUSD_otc", amount=1.0, time=15, check_win=False)
(sell_id, _) = await api.sell(asset="EURUSD_otc", amount=1.0, time=300, check_win=False)
print(buy_id, sell_id)
buy_data = await api.check_win(buy_id)
print(f"Buy trade result: {buy_data['result']}\nBuy trade data: {buy_data}")
sell_data = await api.check_win(sell_id)
print(f"Sell trade result: {sell_data['result']}\nSell trade data: {sell_data}")
if __name__ == '__main__':
ssid = input('Please enter your ssid: ')
asyncio.run(main(ssid))