Skip to main content

aiowhitebit

Async Python client for WhiteBit API

Features

  • Private http V4 API
  • Public WS API
    • Enhanced WebSocket events with event_time and update_id metadata
    • BookTicker WebSocket stream for real-time best bid/ask prices
    • Market depth subscriptions with enhanced metadata support
  • Public http v1
  • Public http v2
  • Public http v4
    • Funding history endpoint for futures markets
  • Webhook support with examples
  • Rate limiting
  • Type hints
  • Pydantic models
  • Async/await support

Installation

pip install aiowhitebit

Quick Start

import asyncio
from aiowhitebit.clients.public import PublicV4Client

async def main():
    client = PublicV4Client()

    # Get market info
    markets = await client.get_market_info()
    print(f"Number of markets: {len(markets)}")

    # Get market activity
    activity = await client.get_market_activity()
    print(f"BTC_USDT last price: {activity.get('BTC_USDT').last_price}")

asyncio.run(main())

New Features in v0.3.0

BookTicker WebSocket Stream

import asyncio
from aiowhitebit.clients.websocket import PublicWebSocketClient, SubscribeRequest

async def bookticker_example():
    client = PublicWebSocketClient()

    # Subscribe to BookTicker stream
    response = await client.bookticker_subscribe("BTC_USDT")
    print(f"Subscribed: {response}")

    # Unsubscribe from BookTicker stream
    response = await client.bookticker_unsubscribe("BTC_USDT")
    print(f"Unsubscribed: {response}")

    await client.close()

asyncio.run(bookticker_example())

Funding History for Futures Markets

import asyncio
from aiowhitebit.clients.public import PublicV4Client

async def funding_history_example():
    client = PublicV4Client()

    # Get funding rate history for BTC_USDT futures
    history = await client.get_funding_history("BTC_USDT")

    for item in history.result:
        print(f"Time: {item.timestamp}, Rate: {item.funding_rate}")

asyncio.run(funding_history_example())

Enhanced WebSocket Events with Metadata

All WebSocket events now include optional event_time and update_id fields for better tracking and synchronization:

# WebSocket responses now include metadata
{
    "method": "depth_update",
    "params": {...},
    "event_time": 1640995200000,  # Event timestamp
    "update_id": 12345           # Unique update identifier
}

Documentation

For detailed documentation and examples, visit our GitHub repository.

Development

# Clone the repository
git clone https://github.com/doubledare704/aiowhitebit.git
cd aiowhitebit

# Install development dependencies
pip install -r requirements-dev.txt

# Install pre-commit hooks
pre-commit install

# Run tests
pytest

License

MIT License - see LICENSE file for details

Metadata

Release files for aiowhitebit 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiowhitebit 0.4.0
File Size Uploaded Provenance
aiowhitebit-0.4.0.tar.gz 45.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aiowhitebit 0.4.0
File Interpreter ABI Platform
aiowhitebit-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 93.4 kB

Release files / aiowhitebit-0.4.0.tar.gz

Download URL aiowhitebit-0.4.0.tar.gz
Size 45.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f156ff07d6909b9ff6d2289c8bf06b141cc0c9306fb5ef2586ea96445282ff5a
BLAKE2b-256 checksum
How to use checksums
bc4ed0b8fbf60858df266dfd0ff5976cbe6eecf5843d8ff16f50f974fb7fb50c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release files / aiowhitebit-0.4.0-py3-none-any.whl

Download URL aiowhitebit-0.4.0-py3-none-any.whl
Size 48.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8fa40faa6e6b2fe16e3c082b4b1c7942680ba90bbaf0cd0de5544e91b2c84b19
BLAKE2b-256 checksum
How to use checksums
5ab55c3221bab89949f4698b127f315008f8165d847919c9fba44a87cce23073
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Security for aiowhitebit 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page