Binance
Installation
pip install binance-python
Usage
Public APIs
You can use specific API clients without authentication. E.g:
from binance.spot import MarketData
client = MarketData()
await client.candles('BTCUSDT', interval='1m', limit=4)
# [Candle(open_time=datetime(...), close_time=datetime(...), open=Decimal('93970.04000000'), ...), ...]
Private API
Easiest is to just use the general client:
from binance import Binance
client = Binance(API_KEY, API_SECRET)
# or client = Binance.env() to load `API_KEY` and `API_SECRET` from environment variables or a .env file
await client.spot.new_order('BTCUSDT', {
'price', 10000, ... # let the type hints guide you
})
Context Manager
To run multiple requests concurrently, I'd recommend using the client as a context manager:
from binance import Binance
client = Binance(API_KEY, API_SECRET)
async with client:
await client.spot.new_order('BTCUSDT', {
'price', 10000, ...
})
await client.spot.new_order('ETHUSDT', {
'price', 2000, ...
})
Supported APIs
Spot
General
Market Data
- Order Book
- Recent Trades
- Old Trades
- Aggregated Trades
- Candles
- UI Candles
- Average Price
- Last 24h Price Change Statistics
- Last Day Price Change Statistics
- Current Price
-
Symbol Order Book Tickerunnecessary, use Order Book instead - Window Price Change Statistics
Trading
- New Order
- Test New Order
- Query Order
- Cancel Order
- Cancel Open Orders
- Replace Order
- Query Open Orders
- Query All Orders
- New OCO Order
- New OTO Order
- New OTOCO Order
- Cancel Order List
-
Query Order Listsupport unplanned - Query
All Order Listssupport unplanned - Query
Open Order Listssupport unplanned -
New SOR Ordersupport unplanned -
Test SOR Ordersupport unplanned
Account
- Information
- List Trades
-
Query Unfilled Order Countsupport unplanned -
Query Prevented Matchessupport unplanned -
Query Allocationssupport unplanned -
Query Commission Ratessupport unplanned
Margin
- Market Data
- Trading
- Borrow and Repay
- Account
- Transfer
Simple Earn
Account
- Account Summary
- List Flexible Products
- List Locked Products
- Flexible Product Position
- Locked Product Position
- Flexible Product Left Quota
- Locked Product Left Quota
Earn
- Subscribe Flexible Product
-
Subscribe Locked Productsupport unplanned - Redeem Flexible Product
-
Redeem Locked Productsupport unplanned -
Set Flexible Auto-Subscribesupport unplanned -
Set Locked Auto-Subscribesupport unplanned - Flexible Subscription Preview
-
Locked Subscription Previewsupport unplanned -
Set Locked Redeem Optionsupport unplanned
History support unplanned
Wallet
Capital
- All Coins Info
- Withdraw
- Withdraw History
- Withdraw Address List
- Deposit History
- Deposit Address
- Deposit Address List
-
One-Click Depositsupport unplanned
Asset support unplanned
Account support unplanned
Travel Rule support unplanned
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
binance_python-0.2.9.tar.gz
(24.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file binance_python-0.2.9.tar.gz.
File metadata
- Download URL: binance_python-0.2.9.tar.gz
- Upload date:
- Size: 24.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64168650bceda69a86a14afbae1ee83f65da652e51469ed02c5a1506060a6c96
|
|
| MD5 |
bb41a5c78a742baea035fc731630664f
|
|
| BLAKE2b-256 |
fb7764db206a73eac558bab7187dba9936e9cafbe67c4abeb1889d1d6e78d9cf
|
File details
Details for the file binance_python-0.2.9-py3-none-any.whl.
File metadata
- Download URL: binance_python-0.2.9-py3-none-any.whl
- Upload date:
- Size: 53.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b90a1a512821b1b2991bd8a4d946f1626beff53215e0a02612d6fa9fa0e9568
|
|
| MD5 |
e8cc81c891126053df5b0a40a1f9d6fe
|
|
| BLAKE2b-256 |
266f86c1ed25b4b6ef1ded550103070ab864eb460d3d8bc01469a930101b7c2e
|