Skip to main content

ABfinance Python API

PyPI version Python License: MIT

Official Python3 API connector for ABFinance's HTTP and WebSocket APIs.

Installation

pip install abfinance-python-api

Requires Python 3.9+

Quick Start

HTTP API

from abfinance_api.unified_trading import HTTP

# Public endpoints (no authentication required)
session = HTTP(testnet=True)
print(session.get_server_time())
print(session.get_orderbook(category="linear", symbol="BTCUSDT"))

# Private endpoints (authentication required)
session = HTTP(
    testnet=True,
    api_key="your_api_key",
    api_secret="your_api_secret",
)

# Get wallet balance
print(session.get_wallet_balance(accountType="UNIFIED"))

# Place an order
print(session.place_order(
    category="linear",
    symbol="BTCUSDT",
    side="Buy",
    orderType="Limit",
    qty="0.01",
    price="30000",
))

WebSocket API

from abfinance_api.unified_trading import WebSocket

def handle_message(message):
    print(message)

# Public WebSocket
ws = WebSocket(testnet=True, channel_type="linear")
ws.orderbook_stream(depth=50, symbol="BTCUSDT", callback=handle_message)

# Private WebSocket
ws_private = WebSocket(
    testnet=True,
    channel_type="private",
    api_key="your_api_key",
    api_secret="your_api_secret",
)
ws_private.order_stream(callback=handle_message)

Features

  • HTTP API support for all endpoints
  • WebSocket API for real-time data
  • HMAC and RSA authentication
  • Testnet and mainnet support

Examples

See the examples directory for more usage examples.

License

MIT License

Metadata

Release files for abfinance-python-api 1.0.6

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

Source distribution (sdist)

Source distribution for abfinance-python-api 1.0.6
File Size Uploaded Provenance Actions
abfinance_python_api-1.0.6.tar.gz 24.8 kB Without provenance Details for abfinance_python_api-1.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for abfinance-python-api 1.0.6
File Interpreter ABI Platform Actions
abfinance_python_api-1.0.6-py2.py3-none-any.whl Python 3, Python 2 none any Details for abfinance_python_api-1.0.6-py2.py3-none-any.whl

Total release size: 50.7 kB

Release files / abfinance_python_api-1.0.6.tar.gz

Download URL abfinance_python_api-1.0.6.tar.gz
Size 24.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ee50a3f9bf0b0130ebbe42f1e9a319193ef883b00a3868ce921358aa52eea8a1
BLAKE2b-256 checksum
How to use checksums
13cd08ff6bede10fcc7cff210994029421e55722f18c367fa4d59a265f5b3190
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / abfinance_python_api-1.0.6-py2.py3-none-any.whl

Download URL abfinance_python_api-1.0.6-py2.py3-none-any.whl
Size 25.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
81e4338120081d1f16d4e51e6f7fd950a441c7b96d9b3e2c70f363f6579a0251
BLAKE2b-256 checksum
How to use checksums
baaa50f2c97a3b897c9d89378b50c0897f0f3cda89f3025a6dcc99675606d420
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for abfinance-python-api 1.0.6

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