Skip to main content

A library to connect to PocketOption using python with async and sync support.

Project description

👉 Join us on Discord

BinaryOptionsToolsV2

Path to the github repository for this version of the project: https://github.com/ChipaDevTeam/BinaryOptionsTools-v2/tree/5ef8aa83bcf3f9b8a55f0d9d5e69a1a48397ed7f

How to install

Install it with PyPi using the following command:

pip install binaryoptionstoolsv2==0.1.6a2

Supported Os

Currently only suppot for Windows is available.

Supported Python versions

Currently only python 3.9 to 3.12 is suported.

Compile from souce (Not recommended)

  • Make sure you have rust and cargo installed (Check here)

  • Install [maturin](https://www.maturin.rs/installation) in order to compile the library

  • Once the source dowloaded (using git clone https://github.com/ChipaDevTeam/BinaryOptionsTools-v2.git) execute the following commands: To create the .whl file

// Inside the root folder
cd BinaryOptionsToolsV2
maturin build -r 

// Once the command is executed it should print a path to a .whl file, copy it and then run
pip install path/to/file.whl

To install the library in a local virtual environment

// Inside the root folder
cd BinaryOptionsToolsV2

// Activate the virtual environment if not done alreade 

// Execute the following command and it shoult automatically install the library in the VM
maturin develop

Docs

Comprehensive Documentation for BinaryOptionsToolsV2

  1. __init__.py

This file initializes the Python module and organizes the imports for both synchronous and asynchronous functionality.

Key Details

  • Imports BinaryOptionsToolsV2: Imports all elements and documentation from the Rust module.
  • Includes Submodules: Imports and exposes pocketoption and tracing modules for user convenience.

Purpose

Serves as the entry point for the package, exposing all essential components of the library.

Inside the pocketoption folder there are 2 main files

  1. asyncronous.py

This file implements the PocketOptionAsync class, which provides an asynchronous interface to interact with Pocket Option.

Key Features of PocketOptionAsync

  • Trade Operations:
    • buy(): Places a buy trade asynchronously.
    • sell(): Places a sell trade asynchronously.
    • check_win(): Checks the outcome of a trade ('win', 'draw', or 'loss').
  • Market Data:
    • get_candles(): Fetches historical candle data.
    • history(): Retrieves recent data for a specific asset.
  • Account Management:
    • balance(): Returns the current account balance.
    • opened_deals(): Lists all open trades.
    • closed_deals(): Lists all closed trades.
    • payout(): Returns payout percentages.
  • Real-Time Data:
    • subscribe_symbol(): Provides an asynchronous iterator for real-time candle updates.

Helper Class - AsyncSubscription

Facilitates asynchronous iteration over live data streams, enabling non-blocking operations.

Example Usage

from BinaryOptionsToolsV2.pocketoption import PocketOptionAsync 
import asyncio 
 
async def main(): 
    client = PocketOptionAsync(ssid="your-session-id") 
    await asyncio.sleep(5)
    balance = await client.balance() 
    print("Account Balance:", balance) 
 
asyncio.run(main()) 
  1. syncronous.py

This file implements the PocketOption class, a synchronous wrapper around the asynchronous interface provided by PocketOptionAsync.

Key Features of PocketOption

  • Trade Operations:
    • buy(): Places a buy trade using synchronous execution.
    • sell(): Places a sell trade.
    • check_win(): Checks the trade outcome synchronously.
  • Market Data:
    • get_candles(): Fetches historical candle data.
    • history(): Retrieves recent data for a specific asset.
  • Account Management:
    • balance(): Retrieves account balance.
    • opened_deals(): Lists all open trades.
    • closed_deals(): Lists all closed trades.
    • payout(): Returns payout percentages.
  • Real-Time Data:
    • subscribe_symbol(): Provides a synchronous iterator for live data updates.

Helper Class - SyncSubscription

Allows synchronous iteration over real-time data streams for compatibility with simpler scripts.

Example Usage

from BinaryOptionsToolsV2.pocketoption import PocketOption 
import time

client = PocketOption(ssid="your-session-id") 
time.sleep(5)
balance = client.balance() 
print("Account Balance:", balance) 
  1. Differences Between PocketOption and PocketOptionAsync
Feature PocketOption (Synchronous) PocketOptionAsync (Asynchronous)
Execution Type Blocking Non-blocking
Use Case Simpler scripts High-frequency or real-time tasks
Performance Slower for concurrent tasks Scales well with concurrent operations

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

BinaryOptionsToolsV2-0.1.6a3.tar.gz (139.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

BinaryOptionsToolsV2-0.1.6a3-cp313-cp313-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

BinaryOptionsToolsV2-0.1.6a3-cp312-none-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.12Windows x86-64

BinaryOptionsToolsV2-0.1.6a3-cp311-none-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.11Windows x86-64

BinaryOptionsToolsV2-0.1.6a3-cp310-none-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.10Windows x86-64

BinaryOptionsToolsV2-0.1.6a3-cp39-none-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.9Windows x86-64

File details

Details for the file BinaryOptionsToolsV2-0.1.6a3.tar.gz.

File metadata

File hashes

Hashes for BinaryOptionsToolsV2-0.1.6a3.tar.gz
Algorithm Hash digest
SHA256 e6c01904889ee6f8b5fc5d09246cb56887be7315e40e990e131c8442dc6fe455
MD5 89b42356db0df74a2d129e2f7050c5af
BLAKE2b-256 bb0732a3c76d6829b4191676a75ac17d722e94dede9122494a81e0e1af70e8cf

See more details on using hashes here.

File details

Details for the file BinaryOptionsToolsV2-0.1.6a3-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for BinaryOptionsToolsV2-0.1.6a3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d74c13f38afebbc7eded6abe4cedcac03960f983d4c7e542f174976d1216479b
MD5 e6c0f750ac1e1dfd4991dd88dadffef2
BLAKE2b-256 2cfa3bc3b4547132fc2f62673c8f212f79208779154ec5cef47fecd8505a3c5a

See more details on using hashes here.

File details

Details for the file BinaryOptionsToolsV2-0.1.6a3-cp312-none-win_amd64.whl.

File metadata

File hashes

Hashes for BinaryOptionsToolsV2-0.1.6a3-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 583066bfd685e270ef02fd62ace2d0e3f3b68ec6cae0d9960a0f16ba2135fe4c
MD5 9b31ee1373a56ccb4d6b04366a596807
BLAKE2b-256 147aeffea043a599685e3770280f808e38ff448f5f496f9ade4c4ad6af279ca2

See more details on using hashes here.

File details

Details for the file BinaryOptionsToolsV2-0.1.6a3-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for BinaryOptionsToolsV2-0.1.6a3-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 988ca4f4dcb9bdd9cb4526e69e021ae1dc7d20f7a19c76f796944dc212785fb6
MD5 f26b980583fd35065e3bf0c1e4d111ce
BLAKE2b-256 378370798c927e225be43bccbc62817e5f0f5afc54da92833703880f8cd06512

See more details on using hashes here.

File details

Details for the file BinaryOptionsToolsV2-0.1.6a3-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for BinaryOptionsToolsV2-0.1.6a3-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 5b92443ebd122044fc1edfa97ed7fea9cfb3d16ddc894297c796ba497ee4a2c3
MD5 ae0c70ccea4b3f71e908757b8a93230b
BLAKE2b-256 6bc078db1cde2454ce33c2f26499353bfcd5d15e5f10511c353dbe2d2cc0577d

See more details on using hashes here.

File details

Details for the file BinaryOptionsToolsV2-0.1.6a3-cp39-none-win_amd64.whl.

File metadata

File hashes

Hashes for BinaryOptionsToolsV2-0.1.6a3-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 afb7aa659c29a8a4bb7e73aec79210cbcc44533ef3af1bcf4ae397e90e4adf1c
MD5 6a17532f651561f6ad50c86886f95c66
BLAKE2b-256 2c10fca34d3c5c22ac823e71d49901a35e023a6fae565b3ff03bcb6fd57d816d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page