Skip to main content

Python client for Binance API

PyPI - Version

This package is automatically generated by the OpenAPI Generator project:

Please do not edit the generated code manually, but rather regenerate it from OpenXAPI.

Supported APIs

Product Module Sub Products
Spot API binance.spot ✅ Spot Trading
✅ Margin Trading
✅ Algo Trading
✅ Wallet
✅ Copy Trading
✅ Convert
✅ Sub Account
✅ Binance Link
✅ Futures Data
✅ Portfolio Margin Pro
✅ Staking
✅ Dual Investment
✅ Mining
✅ Crypto Loan
✅ VIP Loan
✅ C2C
✅ Fiat
✅ NFT
✅ Gift Card
✅ Rebate
✅ Simple Earn
✅ Binance Pay History
USD-M Futures API binance.umfutures ✅ USDS Margined Futures
✅ Binance Link
COIN-M Futures API binance.cmfutures ✅ COIN Margined Futures
Options API binance.options ✅ Options
Portfolio Margin API binance.pmargin ✅ Portfolio Margin

Requirements.

Python 3.8+

Installation & Usage

pip install openxapi-binance

Getting Started

In your own code, to use this library to connect and interact with spot, you can run the following:

import os
import time
from pprint import pprint

from binance import spot
from binance.spot.rest import ApiException
from binance.spot.auth import BinanceAuth

# Defining the host is optional and defaults to https://api.binance.com
# See configuration.py for a list of all supported configuration parameters.
configuration = spot.Configuration(
    host = "https://api.binance.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

conf = spot.Configuration(
    auth=BinanceAuth(
        api_key=os.getenv("BINANCE_API_KEY"),
        # secret_key=os.getenv("BINANCE_SECRET_KEY"), # if you want to use HMAC auth
        private_key_path="/path/to/private_key.pem", # Automatically detects RSA/Ed25519 private keys
    ),
)

# Enter a context with an instance of the API client
with spot.ApiClient(conf) as api_client:
    # Create an instance of the API class
    api_instance = spot.SpotTradingApi(api_client)
    try:
        # Query Commission Rates (USER_DATA)
        api_response = api_instance.get_account_v3(
            timestamp=int(time.time() * 1000)
        )
        print("The response of AccountApi->get_account_v3:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling AccountApi->get_account_v3: %s\n" % e)

Metadata

Release files for openxapi-binance 0.3.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 openxapi-binance 0.3.0
File Size Uploaded
openxapi_binance-0.3.0.tar.gz 563.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openxapi-binance 0.3.0
File Interpreter ABI Platform
openxapi_binance-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 2.3 MB

Release files / openxapi_binance-0.3.0.tar.gz

Download URL openxapi_binance-0.3.0.tar.gz
Size 563.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d314064b2e4e555377fca7013e4c86d6158aec3e5f72c30d454da54637829280
BLAKE2b-256 checksum
How to use checksums
dc68120a290579b09d5698ff8d621925459e7cf5decb33f20fea682b10da9c10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / openxapi_binance-0.3.0-py3-none-any.whl

Download URL openxapi_binance-0.3.0-py3-none-any.whl
Size 1.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
d88caee820e396ce597ad37f3b8a6d8dfd51d141978716fc6b669f6ffed74fc6
BLAKE2b-256 checksum
How to use checksums
f88a982c6cbf9136b6da7654d0f55c3977cf9382df5b544929a27f947b512ae5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

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