Skip to main content

Async Python library for the Ebinex traderoom

Project description

ebinexpy

ebinexpy is an asynchronous Python library for controlling the operational capabilities of the Ebinex trading room from bots, workers, and other services. It is not an HTTP API, does not execute strategies, and does not depend on a browser at runtime.

The current contract is pre-alpha and supports accounts, profiles, balances, live and historical market data, and the OPTION order lifecycle. The TEST account is always the default, and orders on a REAL account are blocked without explicit opt-in.

Installation

ebinexpy requires Python 3.11 or newer. Install the latest published version from PyPI:

python3 -m pip install ebinexpy

The examples use python3, as commonly available on Linux and macOS. On Windows, replace python3 with the Python launcher py.

You do not need to specify a version for a normal installation. To reproduce an environment with an exact release, pin it explicitly:

python3 -m pip install ebinexpy==0.1.1

Upgrade an existing installation to the latest available release with:

python3 -m pip install --upgrade ebinexpy

Verify the installed version:

python3 -c "import ebinexpy; print(ebinexpy.__version__)"

For local development, install the checkout in editable mode with the development dependencies:

python3 -m venv .venv
.venv/bin/python -m pip install -e '.[dev]'

On Windows PowerShell:

py -m venv .venv
.venv\Scripts\python.exe -m pip install -e ".[dev]"

Client lifecycle

import asyncio
import os

from ebinexpy import EbinexClient


async def main() -> None:
    async with EbinexClient(os.environ["EBINEX_EMAIL"], os.environ["EBINEX_PASSWORD"]) as client:
        balance = await client.get_balance()
        assets = await client.list_assets()
        print(balance.amount, [asset.symbol for asset in assets if asset.tradable])


asyncio.run(main())

The constructor does not open connections. connect() authenticates, selects TEST, subscribes to essential topics, and only then marks the client as ready. disconnect() is idempotent and preserves the session; logout() disconnects and removes only the current identity's session. The context manager closes the HTTP and WebSocket connections and event handlers.

Sessions

The default is MemorySessionStore. To restore sessions across processes, use a private file:

from pathlib import Path
from ebinexpy import ClientConfig, EbinexClient

config = ClientConfig.with_file_sessions(Path.home() / ".local/state/ebinexpy")
client = EbinexClient("email", "password", config)

The store uses an identity-derived key, a 0700 directory, a 0600 file, and atomic replacement. The library does not read .env; load secrets into the process with your service's configuration tool.

Market data and streams

Assets and payouts always come from configModes.OPTION; the library does not maintain a static list of tradable assets. Candle dates must be timezone-aware.

from ebinexpy import Timeframe

stream = await client.stream_candles("IDXUSDT", Timeframe.M1)
async with stream:
    async for event in stream:
        print(event.candle.close, event.snapshot)

Candle, ticker, and order book streams have bounded queues and share subscriptions. Superseded snapshots may be coalesced to prevent a slow consumer from blocking the socket. Handlers registered with client.events also run without blocking the receive loop.

OPTION orders

from decimal import Decimal
from ebinexpy import Direction, OrderRequest, Timeframe

# Run only on a deliberately selected TEST account.
request = OrderRequest(
    symbol="IDXUSDT",
    direction=Direction.CALL,
    investment=Decimal("1"),
    timeframe=Timeframe.M1,
    price=Decimal("2998.92"),  # current price observed in the feed
)
order = await client.place_order(request)
settlement = await client.wait_order(order.id)

Only the window between submission and receipt of the broker ID is serialized; accepted orders are tracked independently. An ambiguous submission failure raises OrderSubmissionUnknownError and is never retried. A settlement timeout raises SettlementTimeoutError.last_order; a timeout or unknown result is never converted into a loss.

To enable a REAL account, explicitly construct ClientConfig(environment=AccountEnvironment.REAL, allow_real_trading=True). The same guard also protects client.raw.send() on the execution destination.

Raw access and stability

client.raw.request, subscribe, and send reuse authentication, TLS, readiness, redaction, and account selection. The raw REST/STOMP format is deliberately unstable and may change between pre-alpha versions. Safe HTTP requests may reauthenticate once after a 401 response; order execution is never automatically replayed.

See examples/read_market.py and the DEMO order example with an explicit gate in examples/demo_order.py. The documentation overview and public method examples are available in docs/index.md.

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

ebinexpy-0.1.1.tar.gz (65.0 kB view details)

Uploaded Source

Built Distribution

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

ebinexpy-0.1.1-py3-none-any.whl (43.0 kB view details)

Uploaded Python 3

File details

Details for the file ebinexpy-0.1.1.tar.gz.

File metadata

  • Download URL: ebinexpy-0.1.1.tar.gz
  • Upload date:
  • Size: 65.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ebinexpy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7a4902d03c9e8c316c438dcfa7c9ec8b526d0a8a1f5ab4735661eefd29005167
MD5 c409b064f912cd8c5fcbdaa0a2fcd43a
BLAKE2b-256 34da30fb08bfbf91f15be2bb4214be51ff764741da838077077e929b11ebff42

See more details on using hashes here.

Provenance

The following attestation bundles were made for ebinexpy-0.1.1.tar.gz:

Publisher: release.yml on felipyfgs/ebinexpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ebinexpy-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ebinexpy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 43.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ebinexpy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6233424835f1fe6002a751725f76efbeb66a8eccd0d359df3ddea7b85e94f82c
MD5 77bc55f0ef774d7d4953eed03ddfb169
BLAKE2b-256 c1dbe03590dba504919236b6e1ce8349e13256652d8a4b2c18ffbd0d32275cb1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ebinexpy-0.1.1-py3-none-any.whl:

Publisher: release.yml on felipyfgs/ebinexpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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