Skip to main content

Python Binance API client, with typings.

Project description

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

Project details


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

binance_python-0.2.9-py3-none-any.whl (53.2 kB view details)

Uploaded Python 3

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

Hashes for binance_python-0.2.9.tar.gz
Algorithm Hash digest
SHA256 64168650bceda69a86a14afbae1ee83f65da652e51469ed02c5a1506060a6c96
MD5 bb41a5c78a742baea035fc731630664f
BLAKE2b-256 fb7764db206a73eac558bab7187dba9936e9cafbe67c4abeb1889d1d6e78d9cf

See more details on using hashes here.

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

Hashes for binance_python-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 4b90a1a512821b1b2991bd8a4d946f1626beff53215e0a02612d6fa9fa0e9568
MD5 e8cc81c891126053df5b0a40a1f9d6fe
BLAKE2b-256 266f86c1ed25b4b6ef1ded550103070ab864eb460d3d8bc01469a930101b7c2e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page