Metadata-Version: 2.5
Name: pybynix
Version: 1.0.0
Summary: Unofficial asynchronous Bynix market data and execution client
Project-URL: Homepage, https://github.com/thecmjhb/PyBynix
Project-URL: Repository, https://github.com/thecmjhb/PyBynix
Project-URL: Issues, https://github.com/thecmjhb/PyBynix/issues
Author: C. M. Jubayer Hossain Bappy
License-Expression: MIT
License-File: LICENSE
License-File: NOTICE.md
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Requires-Dist: aiohttp<4,>=3.12
Requires-Dist: httpcore<2,>=1
Requires-Dist: httpx<1,>=0.28
Requires-Dist: python-socketio[asyncio-client]<6,>=5.13
Provides-Extra: browser
Requires-Dist: playwright<2,>=1.49; extra == 'browser'
Provides-Extra: dataframe
Requires-Dist: pandas<4,>=2.2; extra == 'dataframe'
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: pytest-asyncio<2,>=0.24; extra == 'dev'
Requires-Dist: pytest<10,>=8; extra == 'dev'
Requires-Dist: ruff>=0.9; extra == 'dev'
Provides-Extra: network
Requires-Dist: aiohttp-socks<1,>=0.10; extra == 'network'
Requires-Dist: dnspython<3,>=2.6; extra == 'network'
Requires-Dist: httpx[socks]<1,>=0.28; extra == 'network'
Description-Content-Type: text/markdown

<!-- Generated by tools/readmes.py; edit docs/i18n/locales/en.json. -->
<div align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.png">
    <source media="(prefers-color-scheme: light)" srcset="assets/logo.png">
    <img src="assets/logo.png" alt="PyBynix" width="390">
  </picture>
  <h3>Market data. Trade execution. One Python client.</h3>
  <p>An asynchronous Python interface for Bynix, built for trading applications, data pipelines and developer tools.</p>
  <p>
    <img src="https://img.shields.io/badge/Python-3.11%2B-3776AB?logo=python&amp;logoColor=white" alt="Python 3.11+">
    <img src="https://img.shields.io/badge/Version-1.0.0-00843D" alt="Version 1.0.0">
    <img src="https://img.shields.io/badge/License-MIT-22c55e" alt="MIT">
    <img src="https://img.shields.io/badge/Documentation-20_languages-C49A00" alt="20 languages">
  </p>
</div>

<p align="center" dir="ltr"><a href="README.md" title="English"><img src="assets/languages/en.svg" width="58" height="28" alt="English"></a><a href="README.bn.md" title="বাংলা"><img src="assets/languages/bn.svg" width="58" height="28" alt="বাংলা"></a><a href="docs/i18n/README.zh-CN.md" title="中文"><img src="assets/languages/zh-CN.svg" width="58" height="28" alt="中文"></a><a href="docs/i18n/README.hi.md" title="हिन्दी"><img src="assets/languages/hi.svg" width="58" height="28" alt="हिन्दी"></a><a href="docs/i18n/README.es.md" title="Español"><img src="assets/languages/es.svg" width="58" height="28" alt="Español"></a><a href="docs/i18n/README.ar.md" title="العربية"><img src="assets/languages/ar.svg" width="58" height="28" alt="العربية"></a><a href="docs/i18n/README.fr.md" title="Français"><img src="assets/languages/fr.svg" width="58" height="28" alt="Français"></a><a href="docs/i18n/README.pt.md" title="Português"><img src="assets/languages/pt.svg" width="58" height="28" alt="Português"></a><a href="docs/i18n/README.id.md" title="Bahasa Indonesia"><img src="assets/languages/id.svg" width="58" height="28" alt="Bahasa Indonesia"></a><a href="docs/i18n/README.ur.md" title="اردو"><img src="assets/languages/ur.svg" width="58" height="28" alt="اردو"></a><a href="docs/i18n/README.ru.md" title="Русский"><img src="assets/languages/ru.svg" width="58" height="28" alt="Русский"></a><a href="docs/i18n/README.ko.md" title="한국어"><img src="assets/languages/ko.svg" width="58" height="28" alt="한국어"></a><a href="docs/i18n/README.ja.md" title="日本語"><img src="assets/languages/ja.svg" width="58" height="28" alt="日本語"></a><a href="docs/i18n/README.de.md" title="Deutsch"><img src="assets/languages/de.svg" width="58" height="28" alt="Deutsch"></a><a href="docs/i18n/README.tr.md" title="Türkçe"><img src="assets/languages/tr.svg" width="58" height="28" alt="Türkçe"></a><a href="docs/i18n/README.it.md" title="Italiano"><img src="assets/languages/it.svg" width="58" height="28" alt="Italiano"></a><a href="docs/i18n/README.fa.md" title="فارسی"><img src="assets/languages/fa.svg" width="58" height="28" alt="فارسی"></a><a href="docs/i18n/README.vi.md" title="Tiếng Việt"><img src="assets/languages/vi.svg" width="58" height="28" alt="Tiếng Việt"></a><a href="docs/i18n/README.ta.md" title="தமிழ்"><img src="assets/languages/ta.svg" width="58" height="28" alt="தமிழ்"></a><a href="docs/i18n/README.te.md" title="తెలుగు"><img src="assets/languages/te.svg" width="58" height="28" alt="తెలుగు"></a></p>

## 🚀 Capability categories

- 🛡️ **Free/open core** — MIT-licensed public package; public market data works without an account, with optional browser, network, and DataFrame extras.
- ⚡ **Fast market data** — Stream-first ticks, forming/closed candles, bounded historical pages, and concurrent candle batches with REST fallback.
- 🔑 **Multi-login and client pool** — Token, password, browser, and OTP-capable providers plus independent named clients and account events.
- 🤖 **Safe caller-owned automation** — ExecutionOrchestrator/AutoExecutor accepts explicit application intents with dry-run, demo-only defaults, cooldown, concurrency limits, and no uncertain-order retry.
- 📊 **Pure indicators** — Decimal SMA, EMA, RSI, MACD, Bollinger Bands, ATR, and stochastic measurements over caller-owned data; no signals or strategy.
- 🎯 **Execution conveniences** — `buy_and_wait`, `sell`/early close, settlement wait, journaling, and reconciliation around explicit one-order-at-a-time calls.
- 🔍 **Verified Bynix scope** — Read the matrix for implemented, offline-tested, and live-demo-observed behavior; unsupported parity is not implied.

See the full verified scope in the [feature and fallback matrix](docs/FEATURE_MATRIX.md).

## 🛠️ Features

| API | Features |
| --- | --- |
| `connect · PasswordAuth · BrowserAuth` | Session tokens, password login, browser-assisted login and 2FA callbacks. |
| `get_assets · get_asset · get_payouts` | Asset discovery, exact symbol lookup, availability and payout information. |
| `get_candles · get_historical_candles · get_candles_batch` | Recent candles and paginated historical OHLCV with UTC timestamps. |
| `subscribe_ticks · stream_candles · get_tick` | Live ticks, forming/closed candles and automatic REST polling fallback. |
| `place_order · wait_order_result · close_trade_early · ExecutionOrchestrator` | Explicit demo, real and funded orders, settlement lookup and early close. |
| `SQLiteJournal · reconcile_order · unresolved_orders` | Durable order records, restart recovery and duplicate-reference protection. |
| `ClientPool · account_events · get_balance_breakdown` | Independent named clients, account events and detailed balances. |
| `proxy · dns_servers · connect_any` | HTTP/SOCKS5 proxies, custom DNS and trusted-domain connection fallback. |
| `get_realtime_sentiment · stream_sentiment` | Streaming market sentiment using the platform-style candle and tick model. |
| `export_candles · candles_to_dataframe · resample_candles · sma · ema · rsi · macd · bollinger_bands · atr · stochastic` | Decimal-preserving CSV/JSON export, optional pandas and candle resampling. |

## 📦 Installation

Install the published package from PyPI. Add optional browser, networking and DataFrame integrations as needed.

```console
python -m pip install pybynix
```

```console
python -m pip install "pybynix[browser,network,dataframe]"
python -m playwright install chromium
```

## ⚡ Stream your first market

Public market data works without an account. This complete example retrieves candles and reads three incoming ticks.

```python
import asyncio
from pybynix import Bynix

async def main():
    async with Bynix.public() as client:
        candles = await client.get_candles("EUR/USD OTC", interval="1m", count=100)
        print(candles[-1])
        async with await client.subscribe_ticks("EUR/USD OTC") as ticks:
            for _ in range(3):
                tick = await anext(ticks)
                print(tick.timestamp, tick.price)

asyncio.run(main())
```

## 🔐 Authentication and sessions

Use the interactive login command, import an existing Bynix access token, or configure a password/browser provider. Login stores a local session; Python applications can also supply their own session provider. Use the client in an async context manager.

```console
pybynix login
pybynix doctor
pybynix balances
```

```python
import asyncio
import os
from pybynix import Bynix, PasswordAuth, SQLiteJournal

async def main():
    async with Bynix(
        provider=PasswordAuth(os.environ["BYNIX_EMAIL"], os.environ["BYNIX_PASSWORD"]),
        journal=SQLiteJournal("orders.sqlite"),
    ) as client:
        print(await client.get_balance())

asyncio.run(main())
```

## 🎯 Order execution

With a connected authenticated client, place an explicit demo order and await the server result. Demo is the default account. Real or funded execution requires allow_real_trading=True; funded orders also require challenge_id. Keep order IDs and use SQLiteJournal for restart recovery.

```python
async def execute_demo_order(client):
    order = await client.place_order("EUR/USD OTC", "call", "1.00", 5)
    result = await client.wait_order_result(order["trade_id"], timeout=90)
    return result
```

## 🌐 Connections and recovery

Persistent connections, resubscription and bounded queues support continuous consumers. Auto mode uses the platform's REST tick endpoint when streaming is unavailable. Network extras enable authenticated SOCKS5 and custom DNS. Configure the same route on your authentication provider.

```python
client = Bynix.from_token(token, proxy="socks5://user:password@proxy-host:1080")
# HTTP CONNECT: proxy="http://proxy-host:8080"
# Custom DNS: Bynix.from_token(token, dns_servers=["1.1.1.1"])
# Data fallback: Bynix.public(stream_transport="auto")
```

## 💻 Command-line tools

Inspect the platform, stream prices, export candles and check published domains from the terminal. The CLI supplies public data directly and uses a saved session for account commands.

```console
pybynix stream --symbol "EUR/USD OTC" --interval 15s --count 5
pybynix candles --symbol "EUR/USD OTC" --count 100 --output candles.csv
pybynix sentiment --symbol "EUR/USD OTC"
pybynix domains
```

## 📚 Documentation

Detailed signatures, return values, runnable examples and recovery behavior are documented below. Use exact trade_symbol values from the asset catalog.

- [API reference](docs/API.md)
- [Authentication](docs/AUTHENTICATION.md)
- [Examples](examples)
- [Recovery and networking](docs/RECOVERY.md)
- [Automation boundary](docs/AUTOMATION.md)
- [Feature and fallback matrix](docs/FEATURE_MATRIX.md)
- [Launch checklist](docs/LAUNCH_CHECKLIST.md)
- [Repository map](docs/REPOSITORY_MAP.md)
- [Troubleshooting](docs/TROUBLESHOOTING.md)

## 🧪 Testing and performance

The validation record lists tested Python versions, asset/timeframe coverage, demo execution, interrupted connections and measured performance. Reproducible tests and benchmark inputs accompany the source. [Validation](docs/VALIDATION.md) · [Benchmarks](benchmarks)

## 🔬 Research

The architecture, protocol adaptation, and empirical evaluation of PyBynix are documented in our research paper. It covers asynchronous stream recovery, safe order lifecycle handling, and benchmark observations.

## 🤝 Community and license

Contributions, reproducible bug reports and documentation improvements are welcome. PyBynix is independently maintained; platform and language trademarks remain with their owners. [Contributing](CONTRIBUTING.md) · [Security](SECURITY.md) · [MIT](LICENSE)

<p align="center"><strong>C. M. Jubayer Hossain Bappy</strong> · PyBynix</p>
