Skip to main content

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

Trading

Account

  • Information
  • List Trades
  • Query Unfilled Order Count support unplanned
  • Query Prevented Matches support unplanned
  • Query Allocations support unplanned
  • Query Commission Rates support unplanned

Margin

  • Market Data
  • Trading
  • Borrow and Repay
  • Account
  • Transfer

Simple Earn

Account

Earn

History support unplanned

Wallet

Capital

  • All Coins Info
  • Withdraw
  • Withdraw History
  • Withdraw Address List
  • Deposit History
  • Deposit Address
  • Deposit Address List
  • One-Click Deposit support unplanned

Asset support unplanned

Account support unplanned

Travel Rule support unplanned

Metadata

Release files for binance-python 0.2.9

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

Source distribution (sdist)

Source distribution for binance-python 0.2.9
File Size Uploaded
binance_python-0.2.9.tar.gz 24.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for binance-python 0.2.9
File Interpreter ABI Platform
binance_python-0.2.9-py3-none-any.whl Python 3 none any Details

Total release size: 77.2 kB

Release files / binance_python-0.2.9.tar.gz

Download URL binance_python-0.2.9.tar.gz
Size 24.0 kB
Tags Source
SHA-256 checksum
How to use checksums
64168650bceda69a86a14afbae1ee83f65da652e51469ed02c5a1506060a6c96
BLAKE2b-256 checksum
How to use checksums
fb7764db206a73eac558bab7187dba9936e9cafbe67c4abeb1889d1d6e78d9cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.10

Release files / binance_python-0.2.9-py3-none-any.whl

Download URL binance_python-0.2.9-py3-none-any.whl
Size 53.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b90a1a512821b1b2991bd8a4d946f1626beff53215e0a02612d6fa9fa0e9568
BLAKE2b-256 checksum
How to use checksums
266f86c1ed25b4b6ef1ded550103070ab864eb460d3d8bc01469a930101b7c2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.10

Release history Release notifications | RSS feed

This release

0.2.9 This release

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

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