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.2

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.2.tar.gz (28.6 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.2-py3-none-any.whl (43.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ebinexpy-0.1.2.tar.gz
  • Upload date:
  • Size: 28.6 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.2.tar.gz
Algorithm Hash digest
SHA256 636afd07d5eb26f1570a7b9422a9a78971076ce899f1515749c254f9e1690505
MD5 d3aa1eab6f9ba2ce1f92214804e4241e
BLAKE2b-256 b49f17a2f0608c86fa903040fe6ae936b486b96374e66018c1971d47768084bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for ebinexpy-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: ebinexpy-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 50ee04f404e6ac749c5ae30c230704dfccea9901a4f4bbb71965c48aa4f07d0e
MD5 d09fa5124ea8b438bb4b5737cac5a000
BLAKE2b-256 681f4c852234ed3145c5a67269f5172eb72d2db43884b2ccc1dfd2511e80d666

See more details on using hashes here.

Provenance

The following attestation bundles were made for ebinexpy-0.1.2-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